  {
     Int    i;
     HChar* xpre  = VG_(clo_xml) ? "  <line>" : "";
-@@ -999,9 +977,15 @@
+@@ -999,9 +993,15 @@
     UInt (*umsg_or_xml)( const HChar*, ... )
        = VG_(clo_xml) ? VG_(printf_xml) : VG_(umsg);
  

          break;
       }
 
@@ -784,32 +806,7 @@
          break;
 
       case VgLogTo_File: {

-         VG_(log_output_sink).fd = tmp_log_fd;
-         VG_(fcntl)(VG_(log_output_sink).fd, VKI_F_SETFD, VKI_FD_CLOEXEC);
-      }
+      tmp_log_fd = move_fd_into_safe_range(tmp_log_fd, False);
    } else {
       // If they said --log-fd=-1, don't print anything.  Plausible for use in
       // regression testing suites that use client requests to count errors.
@@ -886,18 +888,7 @@
    // Finalise the output fds: and the XML fd ..
 
    if (tmp_xml_fd >= 0) {
