The patches for 3.0.3pre2.
[rsync/rsync-patches.git] / preallocate.diff
index a2b3868..ae870c2 100644 (file)
@@ -228,7 +228,7 @@ diff --git a/rsync.yo b/rsync.yo
   -n, --dry-run               perform a trial run with no changes made
   -W, --whole-file            copy files whole (w/o delta-xfer algorithm)
   -x, --one-file-system       don't cross filesystem boundaries
-@@ -1043,6 +1044,18 @@ NOTE: Don't use this option when the destination is a Solaris "tmpfs"
+@@ -1049,6 +1050,18 @@ NOTE: Don't use this option when the destination is a Solaris "tmpfs"
  filesystem. It doesn't seem to handle seeks over null regions
  correctly and ends up corrupting the files.
  
@@ -305,7 +305,7 @@ diff --git a/util.c b/util.c
  extern int module_id;
  extern int modify_window;
  extern int relative_paths;
-@@ -273,6 +274,10 @@ int copy_file(const char *source, const char *dest, int ofd,
+@@ -276,6 +277,10 @@ int copy_file(const char *source, const char *dest, int ofd,
        int ifd;
        char buf[1024 * 8];
        int len;   /* Number of bytes read into `buf'. */
@@ -315,8 +315,8 @@ diff --git a/util.c b/util.c
 +#endif
  
        if ((ifd = do_open(source, O_RDONLY, 0)) < 0) {
-               rsyserr(FERROR_XFER, errno, "open %s", full_fname(source));
-@@ -294,7 +299,27 @@ int copy_file(const char *source, const char *dest, int ofd,
+               int save_errno = errno;
+@@ -309,7 +314,27 @@ int copy_file(const char *source, const char *dest, int ofd,
                }
        }
  
@@ -342,9 +342,9 @@ diff --git a/util.c b/util.c
 +              offset += len;
 +#endif
                if (full_write(ofd, buf, len) < 0) {
+                       int save_errno = errno;
                        rsyserr(FERROR_XFER, errno, "write %s", full_fname(dest));
-                       close(ifd);
-@@ -315,6 +340,16 @@ int copy_file(const char *source, const char *dest, int ofd,
+@@ -334,6 +359,16 @@ int copy_file(const char *source, const char *dest, int ofd,
                        full_fname(source));
        }
  
@@ -359,5 +359,5 @@ diff --git a/util.c b/util.c
 +#endif
 +
        if (close(ofd) < 0) {
+               int save_errno = errno;
                rsyserr(FERROR_XFER, errno, "close failed on %s",
-                       full_fname(dest));