X-Git-Url: https://mattmccutchen.net/rsync/rsync-patches.git/blobdiff_plain/cbdf862c63c8b1b764247668a83430da0bf49559..6ac9ce9a46c911cbaa7f3d1c33f49f595373622d:/preallocate.diff diff --git a/preallocate.diff b/preallocate.diff index a2b3868..f745892 100644 --- a/preallocate.diff +++ b/preallocate.diff @@ -20,7 +20,7 @@ diff --git a/compat.c b/compat.c extern int append_mode; extern int fuzzy_basis; extern int read_batch; -@@ -184,6 +185,15 @@ void setup_protocol(int f_out,int f_in) +@@ -187,6 +188,15 @@ void setup_protocol(int f_out,int f_in) if (read_batch) check_batch_flags(); @@ -139,16 +139,16 @@ diff --git a/options.c b/options.c {"inplace", 0, POPT_ARG_VAL, &inplace, 1, 0, 0 }, {"no-inplace", 0, POPT_ARG_VAL, &inplace, 0, 0, 0 }, {"append", 0, POPT_ARG_NONE, 0, OPT_APPEND, 0, 0 }, -@@ -2048,6 +2057,9 @@ void server_options(char **args, int *argc_p) +@@ -2061,6 +2070,9 @@ void server_options(char **args, int *argc_p) else if (remove_source_files) args[ac++] = "--remove-sent-files"; + if (preallocate_files && am_sender) + args[ac++] = "--preallocate"; + - *argc_p = ac; - return; - + if (ac > MAX_SERVER_ARGS) { /* Not possible... */ + rprintf(FERROR, "argc overflow in server_options().\n"); + exit_cleanup(RERR_MALLOC); diff --git a/receiver.c b/receiver.c --- a/receiver.c +++ b/receiver.c @@ -203,7 +203,7 @@ diff --git a/receiver.c b/receiver.c diff --git a/rsync.h b/rsync.h --- a/rsync.h +++ b/rsync.h -@@ -608,6 +608,13 @@ struct ht_int64_node { +@@ -614,6 +614,13 @@ struct ht_int64_node { #define ACLS_NEED_MASK 1 #endif @@ -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));