extern int uid_ndx;
extern int gid_ndx;
extern int eol_nulls;
-@@ -345,6 +346,9 @@ static void send_file_entry(int f, struct file_struct *file, int ndx, int first_
+@@ -344,6 +345,9 @@ static void send_file_entry(int f, struct file_struct *file, int ndx, int first_
{
static time_t modtime;
static mode_t mode;
if ((preserve_devices && IS_DEVICE(mode))
|| (preserve_specials && IS_SPECIAL(mode))) {
-@@ -523,6 +533,10 @@ static void send_file_entry(int f, struct file_struct *file, int ndx, int first_
+@@ -522,6 +532,10 @@ static void send_file_entry(int f, struct file_struct *file, int ndx, int first_
}
if (!(xflags & XMIT_SAME_MODE))
write_int(f, to_wire_mode(mode));
if (uid_ndx && !(xflags & XMIT_SAME_UID)) {
if (protocol_version < 30)
write_int(f, uid);
-@@ -611,6 +625,9 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
+@@ -610,6 +624,9 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
{
static int64 modtime;
static mode_t mode;
#ifdef SUPPORT_HARD_LINKS
static int64 dev;
#endif
-@@ -742,9 +759,12 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
+@@ -741,9 +758,12 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
}
if (!(xflags & XMIT_SAME_MODE))
mode = from_wire_mode(read_int(f));
if (uid_ndx && !(xflags & XMIT_SAME_UID)) {
if (protocol_version < 30)
-@@ -866,6 +886,10 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
+@@ -865,6 +885,10 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
OPT_EXTRA(file, 0)->unum = (uint32)(file_length >> 32);
}
file->mode = mode;
if (uid_ndx)
F_OWNER(file) = uid;
if (gid_ndx) {
-@@ -1196,6 +1220,10 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
+@@ -1193,6 +1217,10 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
OPT_EXTRA(file, 0)->unum = (uint32)(st.st_size >> 32);
}
file->mode = st.st_mode;
diff --git a/options.c b/options.c
--- a/options.c
+++ b/options.c
-@@ -51,6 +51,7 @@ int preserve_hard_links = 0;
+@@ -52,6 +52,7 @@ int preserve_hard_links = 0;
int preserve_acls = 0;
int preserve_xattrs = 0;
int preserve_perms = 0;
int preserve_executability = 0;
int preserve_devices = 0;
int preserve_specials = 0;
-@@ -222,6 +223,7 @@ static void print_rsync_version(enum logcode f)
+@@ -223,6 +224,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
-@@ -251,6 +253,9 @@ static void print_rsync_version(enum logcode f)
+@@ -252,6 +254,9 @@ static void print_rsync_version(enum logcode f)
#ifdef ICONV_OPTION
iconv = "";
#endif
rprintf(f, "%s version %s protocol version %d%s\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
-@@ -264,8 +269,8 @@ static void print_rsync_version(enum logcode f)
+@@ -265,8 +270,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());
-@@ -332,6 +337,7 @@ void usage(enum logcode F)
+@@ -333,6 +338,7 @@ void usage(enum logcode F)
rprintf(F," -K, --keep-dirlinks treat symlinked dir on receiver as dir\n");
rprintf(F," -H, --hard-links preserve hard links\n");
rprintf(F," -p, --perms preserve permissions\n");
rprintf(F," -E, --executability preserve the file's executability\n");
rprintf(F," --chmod=CHMOD affect file and/or directory permissions\n");
#ifdef SUPPORT_ACLS
-@@ -472,6 +478,8 @@ static struct poptOption long_options[] = {
+@@ -473,6 +479,8 @@ static struct poptOption long_options[] = {
{"perms", 'p', POPT_ARG_VAL, &preserve_perms, 1, 0, 0 },
{"no-perms", 0, POPT_ARG_VAL, &preserve_perms, 0, 0, 0 },
{"no-p", 0, POPT_ARG_VAL, &preserve_perms, 0, 0, 0 },
{"executability", 'E', POPT_ARG_NONE, &preserve_executability, 0, 0, 0 },
{"acls", 'A', POPT_ARG_NONE, 0, 'A', 0, 0 },
{"no-acls", 0, POPT_ARG_VAL, &preserve_acls, 0, 0, 0 },
-@@ -1287,6 +1295,15 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
+@@ -1289,6 +1297,15 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
}
#endif
if (write_batch && read_batch) {
snprintf(err_buf, sizeof err_buf,
"--write-batch and --read-batch can not be used together\n");
-@@ -1795,6 +1812,9 @@ void server_options(char **args, int *argc_p)
+@@ -1803,6 +1820,9 @@ void server_options(char **args, int *argc_p)
if (xfer_dirs && !recurse && delete_mode && am_sender)
args[ac++] = "--no-r";
static const char *default_charset(void)
{
# if defined HAVE_LIBCHARSET_H && defined HAVE_LOCALE_CHARSET
-@@ -337,6 +348,41 @@ mode_t dest_mode(mode_t flist_mode, mode_t stat_mode, int dflt_perms,
+@@ -338,6 +349,41 @@ mode_t dest_mode(mode_t flist_mode, mode_t stat_mode, int dflt_perms,
return new_mode;
}
int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
const char *fnamecmp, int flags)
{
-@@ -468,6 +514,15 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -469,6 +515,15 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
}
#endif
if (verbose > 1 && flags & ATTRS_REPORT) {
if (updated)
rprintf(FCLIENT, "%s\n", fname);
-@@ -527,6 +582,9 @@ void finish_transfer(const char *fname, const char *fnametmp,
+@@ -528,6 +583,9 @@ void finish_transfer(const char *fname, const char *fnametmp,
set_file_attrs(fnametmp, file, NULL, fnamecmp,
ok_to_set_time ? 0 : ATTRS_SKIP_MTIME);
/* move tmp file over real file */
if (verbose > 2)
rprintf(FINFO, "renaming %s to %s\n", fnametmp, fname);
-@@ -541,6 +599,9 @@ void finish_transfer(const char *fname, const char *fnametmp,
+@@ -542,6 +600,9 @@ void finish_transfer(const char *fname, const char *fnametmp,
}
if (ret == 0) {
/* The file was moved into place (not copied), so it's done. */