Close the output fd when fsync() fails on it.
authorWayne Davison <wayned@samba.org>
Tue, 20 Mar 2007 17:09:09 +0000 (17:09 +0000)
committerWayne Davison <wayned@samba.org>
Tue, 20 Mar 2007 17:09:09 +0000 (17:09 +0000)
fsync.diff

index 276c454f8a779e5cce34b10e1713b63d89a6b158..9877bcb407d22c4500a509596e2f4d4a9859d645 100644 (file)
@@ -86,13 +86,14 @@ To use this patch, run these commands for a successful build:
  extern int modify_window;
  extern int relative_paths;
  extern int human_readable;
-@@ -309,6 +310,12 @@ int copy_file(const char *source, const 
+@@ -309,6 +310,13 @@ int copy_file(const char *source, const 
                        full_fname(source));
        }
  
 +      if (do_fsync && fsync(ofd) < 0) {
 +              rsyserr(FERROR, errno, "fsync failed on %s",
 +                      full_fname(dest));
++              close(ofd);
 +              return -1;
 +      }
 +