make
diff --git a/compat.c b/compat.c
+index 6e00072..c9590cc 100644
--- a/compat.c
+++ b/compat.c
-@@ -33,6 +33,7 @@ extern int inplace;
+@@ -32,6 +32,7 @@ extern int inplace;
extern int recurse;
extern int use_qsort;
extern int allow_inc_recurse;
extern int append_mode;
extern int fuzzy_basis;
extern int read_batch;
-@@ -187,6 +188,15 @@ void setup_protocol(int f_out,int f_in)
+@@ -186,6 +187,15 @@ void setup_protocol(int f_out,int f_in)
if (read_batch)
check_batch_flags();
if (append_mode == 1)
append_mode = 2;
diff --git a/configure.in b/configure.in
+index bc7d4a7..61f9b05 100644
--- a/configure.in
+++ b/configure.in
-@@ -554,13 +554,40 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \
- strlcat strlcpy strtol mallinfo getgroups setgroups geteuid getegid \
+@@ -553,13 +553,40 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \
setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \
strerror putenv iconv_open locale_charset nl_langinfo getxattr \
-- extattr_get_link sigaction sigprocmask setattrlist)
-+ extattr_get_link sigaction sigprocmask setattrlist fallocate posix_fallocate)
+ extattr_get_link sigaction sigprocmask setattrlist getgrouplist \
+- initgroups)
++ initgroups fallocate posix_fallocate)
dnl cygwin iconv.h defines iconv_open as libiconv_open
if test x"$ac_cv_func_iconv_open" != x"yes"; then
if test $ac_cv_func_getpgrp = yes; then
AC_FUNC_GETPGRP
diff --git a/options.c b/options.c
+index e7c6c61..6f848f1 100644
--- a/options.c
+++ b/options.c
@@ -73,6 +73,7 @@ int remove_source_files = 0;
int do_compression = 0;
int def_compress_level = Z_DEFAULT_COMPRESSION;
int am_root = 0; /* 0 = normal, 1 = root, 2 = --super, -1 = --fake-super */
-@@ -225,6 +226,7 @@ static void print_rsync_version(enum logcode f)
+@@ -566,6 +567,7 @@ static void print_rsync_version(enum logcode f)
char const *links = "no ";
char const *iconv = "no ";
char const *ipv6 = "no ";
STRUCT_STAT *dumstat;
#if SUBPROTOCOL_VERSION != 0
-@@ -258,6 +260,9 @@ static void print_rsync_version(enum logcode f)
+@@ -599,6 +601,9 @@ static void print_rsync_version(enum logcode f)
#if defined HAVE_LUTIMES && defined HAVE_UTIMES
symtimes = "";
#endif
rprintf(f, "%s version %s protocol version %d%s\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
-@@ -271,8 +276,8 @@ static void print_rsync_version(enum logcode f)
+@@ -612,8 +617,8 @@ static void print_rsync_version(enum logcode f)
(int)(sizeof (int64) * 8));
rprintf(f, " %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
got_socketpair, hardlinks, links, ipv6, have_inplace);
#ifdef MAINTAINER_MODE
rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -359,6 +364,9 @@ void usage(enum logcode F)
+@@ -703,6 +708,9 @@ void usage(enum logcode F)
rprintf(F," --fake-super store/recover privileged attrs using xattrs\n");
#endif
rprintf(F," -S, --sparse handle sparse files efficiently\n");
rprintf(F," -n, --dry-run perform a trial run with no changes made\n");
rprintf(F," -W, --whole-file copy files whole (without delta-xfer algorithm)\n");
rprintf(F," -x, --one-file-system don't cross filesystem boundaries\n");
-@@ -543,6 +551,7 @@ static struct poptOption long_options[] = {
+@@ -899,6 +907,7 @@ static struct poptOption long_options[] = {
{"sparse", 'S', POPT_ARG_VAL, &sparse_files, 1, 0, 0 },
{"no-sparse", 0, POPT_ARG_VAL, &sparse_files, 0, 0, 0 },
{"no-S", 0, POPT_ARG_VAL, &sparse_files, 0, 0, 0 },
{"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 },
-@@ -2063,6 +2072,9 @@ void server_options(char **args, int *argc_p)
+@@ -2609,6 +2618,9 @@ void server_options(char **args, int *argc_p)
else if (remove_source_files)
args[ac++] = "--remove-sent-files";
rprintf(FERROR, "argc overflow in server_options().\n");
exit_cleanup(RERR_MALLOC);
diff --git a/receiver.c b/receiver.c
+index 4325e30..739a0ba 100644
--- a/receiver.c
+++ b/receiver.c
-@@ -45,6 +45,7 @@ extern int cleanup_got_literal;
+@@ -44,6 +44,7 @@ extern int cleanup_got_literal;
extern int remove_source_files;
extern int append_mode;
extern int sparse_files;
+extern int preallocate_files;
extern int keep_partial;
+ extern int checksum_len;
extern int checksum_seed;
- extern int inplace;
@@ -175,6 +176,18 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
char *data;
int32 i;
read_sum_head(f_in, &sum);
-@@ -285,7 +298,15 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
+@@ -285,8 +298,14 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
goto report_write_error;
#ifdef HAVE_FTRUNCATE
- if (inplace && fd != -1
+- && ftruncate(fd, offset) < 0) {
+ /* inplace: New data could be shorter than old data.
+ * preallocate_files: total_size could have been an overestimate.
+ * Cut off any extra preallocated zeros from dest file. */
-+ if (fd != -1
++ if ((inplace
+#ifdef SUPPORT_PREALLOCATION
-+ && (inplace || preallocated_len > offset)
-+#else
-+ && inplace
++ || preallocated_len > offset
+#endif
- && ftruncate(fd, offset) < 0) {
++ ) && fd != -1 && ftruncate(fd, offset) < 0) {
rsyserr(FERROR_XFER, errno, "ftruncate failed on %s",
full_fname(fname));
+ }
diff --git a/rsync.h b/rsync.h
+index be7cf8a..0ad3075 100644
--- a/rsync.h
+++ b/rsync.h
-@@ -614,6 +614,13 @@ struct ht_int64_node {
+@@ -634,6 +634,13 @@ struct ht_int64_node {
#define ACLS_NEED_MASK 1
#endif
int32 num;
uint32 unum;
diff --git a/rsync.yo b/rsync.yo
+index 941f7a5..36a2077 100644
--- a/rsync.yo
+++ b/rsync.yo
-@@ -356,6 +356,7 @@ to the detailed description below for a complete description. verb(
+@@ -359,6 +359,7 @@ to the detailed description below for a complete description. verb(
--super receiver attempts super-user activities
--fake-super store/recover privileged attrs using xattrs
-S, --sparse handle sparse files efficiently
-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
-@@ -1053,6 +1054,18 @@ NOTE: Don't use this option when the destination is a Solaris "tmpfs"
+@@ -1120,6 +1121,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.
make any changes (and produces mostly the same output as a real run). It
is most commonly used in combination with the bf(-v, --verbose) and/or
diff --git a/syscall.c b/syscall.c
+index cfabc3e..81fb957 100644
--- a/syscall.c
+++ b/syscall.c
@@ -29,6 +29,10 @@
+}
+#endif
diff --git a/t_stub.c b/t_stub.c
+index 02cfa69..52a7f02 100644
--- a/t_stub.c
+++ b/t_stub.c
@@ -22,6 +22,7 @@
+int preallocate_files = 0;
int module_id = -1;
int relative_paths = 0;
- int human_readable = 0;
+ int module_dirlen = 0;
diff --git a/util.c b/util.c
+index 0cafed6..20dd0d3 100644
--- a/util.c
+++ b/util.c
-@@ -25,6 +25,7 @@
+@@ -26,6 +26,7 @@
+ #include "inums.h"
- extern int verbose;
extern int dry_run;
+extern int preallocate_files;
extern int module_id;