}
- if (set_file_attrs(fname, file, statret ? NULL : &st, 0)
+ if (set_file_attrs(fname, file, statret ? NULL : &sx, 0)
- && verbose && code && f_out != -1)
+ && verbose && code != FNONE && f_out != -1)
rprintf(code, "%s/\n", fname);
if (delete_during && f_out != -1 && !phase && dry_run < 2
&& (file->flags & FLAG_DEL_HERE))
statret = -1;
} else if (basis_dir[0] != NULL) {
if (try_dests_non(file, fname, ndx, itemizing,
-@@ -1014,7 +1066,7 @@ static void recv_generator(char *fname,
+@@ -1015,7 +1067,7 @@ static void recv_generator(char *fname,
}
}
if (preserve_hard_links && file->link_u.links
itemizing, code, HL_SKIP))
return;
if (do_symlink(file->u.link,fname) != 0) {
-@@ -1023,7 +1075,7 @@ static void recv_generator(char *fname,
+@@ -1024,7 +1076,7 @@ static void recv_generator(char *fname,
} else {
set_file_attrs(fname, file, NULL, 0);
if (itemizing) {
+ itemize(file, ndx, statret, &sx,
ITEM_LOCAL_CHANGE, 0, NULL);
}
- if (code && verbose) {
-@@ -1054,18 +1106,22 @@ static void recv_generator(char *fname,
- itemizing = code = 0;
+ if (code != FNONE && verbose) {
+@@ -1056,18 +1108,22 @@ static void recv_generator(char *fname,
+ code = FNONE;
}
}
+#ifdef SUPPORT_ACLS
statret = -1;
if (verbose > 2) {
rprintf(FINFO,"mknod(%s,0%o,0x%x)\n",
-@@ -1078,7 +1134,7 @@ static void recv_generator(char *fname,
+@@ -1080,7 +1136,7 @@ static void recv_generator(char *fname,
} else {
set_file_attrs(fname, file, NULL, 0);
if (itemizing) {
+ itemize(file, ndx, statret, &sx,
ITEM_LOCAL_CHANGE, 0, NULL);
}
- if (code && verbose)
-@@ -1092,14 +1148,14 @@ static void recv_generator(char *fname,
+ if (code != FNONE && verbose)
+@@ -1094,14 +1150,14 @@ static void recv_generator(char *fname,
}
} else {
if (itemizing)
}
if (!S_ISREG(file->mode)) {
-@@ -1133,7 +1189,7 @@ static void recv_generator(char *fname,
+@@ -1135,7 +1191,7 @@ static void recv_generator(char *fname,
}
if (update_only && statret == 0
if (verbose > 1)
rprintf(FINFO, "%s is newer\n", fname);
return;
-@@ -1142,20 +1198,20 @@ static void recv_generator(char *fname,
+@@ -1144,20 +1200,20 @@ static void recv_generator(char *fname,
fnamecmp = fname;
fnamecmp_type = FNAMECMP_FNAME;
}
if (j >= 0) {
fnamecmp = fnamecmpbuf;
-@@ -1165,7 +1221,7 @@ static void recv_generator(char *fname,
+@@ -1167,7 +1223,7 @@ static void recv_generator(char *fname,
}
real_ret = statret;
if (partial_dir && (partialptr = partial_dir_fname(fname)) != NULL
&& link_stat(partialptr, &partial_st, 0) == 0
-@@ -1184,7 +1240,7 @@ static void recv_generator(char *fname,
+@@ -1186,7 +1242,7 @@ static void recv_generator(char *fname,
rprintf(FINFO, "fuzzy basis selected for %s: %s\n",
fname, fnamecmpbuf);
}
statret = 0;
fnamecmp = fnamecmpbuf;
fnamecmp_type = FNAMECMP_FUZZY;
-@@ -1193,7 +1249,7 @@ static void recv_generator(char *fname,
+@@ -1195,7 +1251,7 @@ static void recv_generator(char *fname,
if (statret != 0) {
if (preserve_hard_links && file->link_u.links
itemizing, code, HL_SKIP))
return;
if (stat_errno == ENOENT)
-@@ -1203,39 +1259,52 @@ static void recv_generator(char *fname,
+@@ -1205,39 +1261,52 @@ static void recv_generator(char *fname,
return;
}
fnamecmp = partialptr;
fnamecmp_type = FNAMECMP_PARTIAL_DIR;
statret = 0;
-@@ -1259,17 +1328,21 @@ static void recv_generator(char *fname,
+@@ -1261,17 +1330,21 @@ static void recv_generator(char *fname,
pretend_missing:
/* pretend the file didn't exist */
if (preserve_hard_links && file->link_u.links
}
if (!(back_file = make_file(fname, NULL, NULL, 0, NO_FILTERS))) {
close(fd);
-@@ -1280,7 +1353,7 @@ static void recv_generator(char *fname,
+@@ -1282,7 +1355,7 @@ static void recv_generator(char *fname,
full_fname(backupptr));
free(back_file);
close(fd);
}
if ((f_copy = do_open(backupptr,
O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600)) < 0) {
-@@ -1288,14 +1361,14 @@ static void recv_generator(char *fname,
+@@ -1290,14 +1363,14 @@ static void recv_generator(char *fname,
full_fname(backupptr));
free(back_file);
close(fd);
}
if (verbose > 2)
-@@ -1313,24 +1386,32 @@ static void recv_generator(char *fname,
+@@ -1315,24 +1388,32 @@ static void recv_generator(char *fname,
iflags |= ITEM_BASIS_TYPE_FOLLOWS;
if (fnamecmp_type == FNAMECMP_FUZZY)
iflags |= ITEM_XNAME_FOLLOWS;
if (f_copy >= 0) {
close(f_copy);
-@@ -1343,6 +1424,13 @@ static void recv_generator(char *fname,
+@@ -1345,6 +1426,13 @@ static void recv_generator(char *fname,
}
close(fd);
}
void generate_files(int f_out, struct file_list *flist, char *local_name)
-@@ -1402,6 +1490,8 @@ void generate_files(int f_out, struct fi
+@@ -1404,6 +1492,8 @@ void generate_files(int f_out, struct fi
* notice that and let us know via the redo pipe (or its closing). */
ignore_timeout = 1;
statret = 1;
- st = &st3;
+ sxp->st = st3;
- if (verbose < 2 || !stdout_format_has_i)
- itemizing = code = 0;
- break;
-@@ -223,12 +228,16 @@ int hard_link_check(struct file_struct *
+ if (verbose < 2 || !stdout_format_has_i) {
+ itemizing = 0;
+ code = FNONE;
+@@ -225,12 +230,16 @@ int hard_link_check(struct file_struct *
if (!unchanged_file(cmpbuf, file, &st3))
continue;
statret = 1;
toname, &st2, itemizing, code);
if (remove_source_files == 1 && do_xfers) {
char numbuf[4];
-@@ -246,7 +255,7 @@ int hard_link_check(struct file_struct *
+@@ -248,7 +257,7 @@ int hard_link_check(struct file_struct *
#ifdef SUPPORT_HARD_LINKS
int hard_link_one(struct file_struct *file, int ndx, char *fname,
int itemizing, enum logcode code)
{
if (do_link(toname, fname)) {
-@@ -262,7 +271,11 @@ int hard_link_one(struct file_struct *fi
+@@ -264,7 +273,11 @@ int hard_link_one(struct file_struct *fi
}
if (itemizing) {
ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS, 0,
terse ? "" : toname);
}
-@@ -279,11 +292,12 @@ void hard_link_cluster(struct file_struc
+@@ -281,11 +294,12 @@ void hard_link_cluster(struct file_struc
#ifdef SUPPORT_HARD_LINKS
char hlink1[MAXPATHLEN];
char *hlink2;
return;
if (!(file->flags & FLAG_HLINK_TOL)) {
while (!(file->flags & FLAG_HLINK_EOL)) {
-@@ -297,9 +311,13 @@ void hard_link_cluster(struct file_struc
+@@ -299,9 +313,13 @@ void hard_link_cluster(struct file_struc
if (file->F_HLINDEX != SKIPPED_LINK)
continue;
hlink2 = f_name(file, NULL);
+int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype);
--- old/log.c
+++ new/log.c
-@@ -607,8 +607,10 @@ static void log_formatted(enum logcode c
+@@ -615,8 +615,10 @@ static void log_formatted(enum logcode c
n[5] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
n[6] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
n[7] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
extern struct stats stats;
extern char *stdout_format;
extern char *tmpdir;
-@@ -349,6 +350,10 @@ int recv_files(int f_in, struct file_lis
+@@ -350,6 +351,10 @@ int recv_files(int f_in, struct file_lis
int itemizing = am_server ? logfile_format_has_i : stdout_format_has_i;
enum logcode log_code = log_before_transfer ? FLOG : FINFO;
int max_phase = protocol_version >= 29 ? 2 : 1;
int i, recv_ok;
if (verbose > 2)
-@@ -549,7 +554,16 @@ int recv_files(int f_in, struct file_lis
+@@ -553,7 +558,16 @@ int recv_files(int f_in, struct file_lis
* mode based on the local permissions and some heuristics. */
if (!preserve_perms) {
int exists = fd1 != -1;
#include "byteorder.h"
#include "lib/mdfour.h"
#include "lib/wildmatch.h"
-@@ -668,6 +688,16 @@ struct chmod_mode_struct;
-
+@@ -669,6 +689,16 @@ struct chmod_mode_struct;
#define UNUSED(x) x __attribute__((__unused__))
+ #define NORETURN __attribute__((__noreturn__))
+typedef struct {
+ STRUCT_STAT st;
void *save_filters;
unsigned int len = strlen(fbuf);
if (len > 1 && fbuf[len-1] == '/')
-@@ -1585,8 +1610,9 @@ static void clean_flist(struct file_list
+@@ -1581,8 +1606,9 @@ static void clean_flist(struct file_list
}
/* Make sure we don't lose track of a user-specified
* top directory. */
clear_file(flist->files[drop], flist);
-@@ -1710,7 +1736,7 @@ static void output_flist(struct file_lis
+@@ -1706,7 +1732,7 @@ static void output_flist(struct file_lis
file->dirname ? file->dirname : "",
file->dirname ? "/" : "", NS(file->basename),
S_ISDIR(file->mode) ? "/" : "", (int)file->mode,
extern int omit_dir_times;
extern int delete_mode;
extern int delete_before;
-@@ -89,6 +90,7 @@ extern dev_t filesystem_dev;
+@@ -90,6 +91,7 @@ extern dev_t filesystem_dev;
extern char *backup_dir;
extern char *backup_suffix;
extern int backup_suffix_len;
extern struct file_list *the_file_list;
extern struct filter_list_struct server_filter_list;
-@@ -181,7 +183,7 @@ static int delete_item(char *fname, int
+@@ -182,7 +184,7 @@ static int delete_item(char *fname, int
for (j = dirlist->count; j--; ) {
struct file_struct *fp = dirlist->files[j];
continue;
strlcpy(p, fp->basename, remainder);
-@@ -259,7 +261,7 @@ static void delete_in_dir(struct file_li
+@@ -260,7 +262,7 @@ static void delete_in_dir(struct file_li
filt_array[cur_depth] = push_local_filters(fbuf, dlen);
if (one_file_system) {
filesystem_dev = stp->st_dev;
else if (filesystem_dev != stp->st_dev)
return;
-@@ -271,7 +273,7 @@ static void delete_in_dir(struct file_li
+@@ -272,7 +274,7 @@ static void delete_in_dir(struct file_li
* from the filesystem. */
for (i = dirlist->count; i--; ) {
struct file_struct *fp = dirlist->files[i];
continue;
if (flist_find(flist, fp) < 0) {
f_name(fp, delbuf);
-@@ -297,11 +299,11 @@ static void do_delete_pass(struct file_l
+@@ -298,11 +300,11 @@ static void do_delete_pass(struct file_l
for (j = 0; j < flist->count; j++) {
struct file_struct *file = flist->files[j];
rprintf(FINFO, "deleting in %s\n", fbuf);
if (link_stat(fbuf, &st, keep_dirlinks) < 0
-@@ -345,6 +347,9 @@ void itemize(struct file_struct *file, i
+@@ -346,6 +348,9 @@ void itemize(struct file_struct *file, i
&& (!(iflags & ITEM_XNAME_FOLLOWS) || *xname))
|| (keep_time && cmp_time(file->modtime, st->st_mtime) != 0))
iflags |= ITEM_REPORT_TIME;
if ((file->mode & CHMOD_BITS) != (st->st_mode & CHMOD_BITS))
iflags |= ITEM_REPORT_PERMS;
if (preserve_uid && am_root && file->uid != st->st_uid)
-@@ -548,7 +553,7 @@ static int find_fuzzy(struct file_struct
+@@ -549,7 +554,7 @@ static int find_fuzzy(struct file_struct
uint32 dist;
if (!S_ISREG(fp->mode) || !fp->length
continue;
name = fp->basename;
-@@ -657,6 +662,8 @@ static int try_dests_reg(struct file_str
+@@ -658,6 +663,8 @@ static int try_dests_reg(struct file_str
itemizing && verbose > 1,
code) < 0)
goto try_a_copy;
if (preserve_hard_links && file->link_u.links) {
if (dry_run)
file->link_u.links->link_dest_used = j + 1;
-@@ -937,7 +944,7 @@ static void recv_generator(char *fname,
- && verbose && code && f_out != -1)
+@@ -944,7 +951,7 @@ static void recv_generator(char *fname,
+ && verbose && code != FNONE && f_out != -1)
rprintf(code, "%s/\n", fname);
if (delete_during && f_out != -1 && !phase && dry_run < 2
- && (file->flags & FLAG_DEL_HERE))
delete_in_dir(the_file_list, fname, file, &st);
return;
}
-@@ -1240,7 +1247,7 @@ static void recv_generator(char *fname,
+@@ -1249,7 +1256,7 @@ static void recv_generator(char *fname,
if (fuzzy_dirlist) {
int j = flist_find(fuzzy_dirlist, file);
if (j >= 0) /* don't use changing file as future fuzzy basis */
head = hlink_list[file->F_HLINDEX] = file->F_NEXT;
else
head = hlink_list[file->F_HLINDEX];
-@@ -285,8 +286,8 @@ void hard_link_cluster(struct file_struc
+@@ -287,8 +288,8 @@ void hard_link_cluster(struct file_struc
file->F_HLINDEX = FINISHED_LINK;
if (link_stat(f_name(file, hlink1), &st1, 0) < 0)
return;
ndx = file->F_NEXT;
file = FPTR(ndx);
}
-@@ -306,6 +307,6 @@ void hard_link_cluster(struct file_struc
+@@ -308,6 +309,6 @@ void hard_link_cluster(struct file_struc
send_msg(MSG_SUCCESS, numbuf, 4);
}
file->F_HLINDEX = FINISHED_LINK;
extern int protocol_version;
extern int preserve_times;
+extern int preserve_atimes;
+ extern int in_exit_cleanup;
extern int stdout_format_has_i;
extern int stdout_format_has_o_or_i;
- extern int logfile_format_has_i;
-@@ -609,7 +610,8 @@ static void log_formatted(enum logcode c
+@@ -615,7 +616,8 @@ static void log_formatted(enum logcode c
n[5] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
n[6] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
n[7] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
{"omit-dir-times", 'O', POPT_ARG_VAL, &omit_dir_times, 2, 0, 0 },
{"modify-window", 0, POPT_ARG_INT, &modify_window, OPT_MODIFY_WINDOW, 0, 0 },
{"super", 0, POPT_ARG_VAL, &am_root, 2, 0, 0 },
-@@ -1537,6 +1542,8 @@ void server_options(char **args,int *arg
+@@ -1531,6 +1536,8 @@ void server_options(char **args,int *arg
argstr[x++] = 'D';
if (preserve_times)
argstr[x++] = 't';
--super receiver attempts super-user activities
-S, --sparse handle sparse files efficiently
-n, --dry-run show what would have been transferred
-@@ -863,6 +864,12 @@ it is preserving modification times (see
+@@ -861,6 +862,12 @@ it is preserving modification times (see
the directories on the receiving side, it is a good idea to use bf(-O).
This option is inferred if you use bf(--backup) without bf(--backup-dir).
dit(bf(--super)) This tells the receiving side to attempt super-user
activities even if the receiving rsync wasn't run by the super-user. These
activities include: preserving users via the bf(--owner) option, preserving
-@@ -1384,7 +1391,7 @@ with older versions of rsync, but that a
+@@ -1382,7 +1389,7 @@ with older versions of rsync, but that a
verbose messages).
The "%i" escape has a cryptic output that is 9 letters long. The general
type of update being done, bf(X) is replaced by the file-type, and the
other letters represent attributes that may be output if they are being
modified.
-@@ -1424,7 +1431,7 @@ quote(itemize(
+@@ -1422,7 +1429,7 @@ quote(itemization(
by the file transfer.
it() A bf(t) means the modification time is different and is being updated
to the sender's value (requires bf(--times)). An alternate value of bf(T)
anytime a symlink is transferred, or when a file or device is transferred
without bf(--times).
it() A bf(p) means the permissions are different and are being updated to
-@@ -1433,7 +1440,10 @@ quote(itemize(
+@@ -1431,7 +1438,10 @@ quote(itemization(
sender's value (requires bf(--owner) and super-user privileges).
it() A bf(g) means the group is different and is being updated to the
sender's value (requires bf(--group) and the authority to set the group).
}
--- old/util.c
+++ new/util.c
-@@ -121,7 +121,7 @@ void overflow_exit(char *str)
+@@ -121,7 +121,7 @@ NORETURN void overflow_exit(char *str)
exit_cleanup(RERR_MALLOC);
}
--- old/Makefile.in
+++ new/Makefile.in
-@@ -6,7 +6,7 @@ exec_prefix=@exec_prefix@
+@@ -7,7 +7,7 @@ exec_prefix=@exec_prefix@
bindir=@bindir@
mandir=@mandir@
/**
* Close all open sockets and files, allowing a (somewhat) graceful
* shutdown() of socket connections. This eliminates the abortive
-@@ -103,9 +99,6 @@ void _exit_cleanup(int code, const char
- }
- inside_cleanup++;
+@@ -98,9 +94,6 @@ NORETURN void _exit_cleanup(int code, co
+ {
+ int ocode = code;
- SIGACTION(SIGUSR1, SIG_IGN);
- SIGACTION(SIGUSR2, SIG_IGN);
-
+ in_exit_cleanup = 1;
+
if (verbose > 3) {
- rprintf(FINFO,"_exit_cleanup(code=%d, file=%s, line=%d): entered\n",
- code, file, line);
-@@ -137,8 +130,6 @@ void _exit_cleanup(int code, const char
+@@ -133,8 +126,6 @@ NORETURN void _exit_cleanup(int code, co
io_flush(FULL_FLUSH);
if (cleanup_fname)
do_unlink(cleanup_fname);
extern int protocol_version;
extern int fuzzy_basis;
extern int always_checksum;
-@@ -94,6 +93,11 @@ extern struct filter_list_struct server_
+@@ -95,6 +94,11 @@ extern struct filter_list_struct server_
static int deletion_count = 0; /* used to implement --max-delete */
/* For calling delete_file() */
#define DEL_FORCE_RECURSE (1<<1) /* recurse even w/o --force */
#define DEL_TERSE (1<<3)
-@@ -444,8 +448,8 @@ static void sum_sizes_sqroot(struct sum_
+@@ -445,8 +449,8 @@ static void sum_sizes_sqroot(struct sum_
}
if (protocol_version < 27) {
s2length = SUM_LENGTH;
} else {
int32 c;
-@@ -455,7 +459,7 @@ static void sum_sizes_sqroot(struct sum_
- for (c = blength; c >>= 1 && b; b--) {}
+@@ -456,7 +460,7 @@ static void sum_sizes_sqroot(struct sum_
+ for (c = blength; (c >>= 1) && b; b--) {}
/* add a bit, subtract rollsum, round up. */
s2length = (b + 1 - 32 + 7) / 8; /* --optimize in compiler-- */
- s2length = MAX(s2length, csum_length);
s2length = MIN(s2length, SUM_LENGTH);
}
-@@ -489,7 +493,7 @@ static void generate_and_send_sums(int f
+@@ -490,7 +494,7 @@ static void generate_and_send_sums(int f
sum_sizes_sqroot(&sum, len);
write_sum_head(f_out, &sum);
return;
if (len > 0)
-@@ -508,7 +512,7 @@ static void generate_and_send_sums(int f
+@@ -509,7 +513,7 @@ static void generate_and_send_sums(int f
if (f_copy >= 0) {
full_write(f_copy, map, n1);
continue;
}
-@@ -1200,7 +1204,7 @@ static void recv_generator(char *fname,
+@@ -1205,7 +1209,7 @@ static void recv_generator(char *fname,
return;
}
return;
if (fnamecmp_type <= FNAMECMP_BASIS_DIR_HIGH)
-@@ -1263,7 +1267,7 @@ static void recv_generator(char *fname,
+@@ -1268,7 +1272,7 @@ static void recv_generator(char *fname,
goto notify_others;
}
if (!(backupptr = get_backup_name(fname))) {
close(fd);
return;
-@@ -1354,9 +1358,12 @@ void generate_files(int f_out, struct fi
+@@ -1359,9 +1363,12 @@ void generate_files(int f_out, struct fi
int save_ignore_existing = ignore_existing;
int save_ignore_non_existing = ignore_non_existing;
int save_do_progress = do_progress;
if (protocol_version >= 29) {
itemizing = 1;
maybe_ATTRS_REPORT = stdout_format_has_i ? 0 : ATTRS_REPORT;
-@@ -1384,7 +1391,7 @@ void generate_files(int f_out, struct fi
+@@ -1389,7 +1396,7 @@ void generate_files(int f_out, struct fi
do_delete_pass(flist);
do_progress = 0;
whole_file = 0;
if (verbose >= 2) {
rprintf(FINFO, "delta-transmission %s\n",
-@@ -1393,12 +1400,6 @@ void generate_files(int f_out, struct fi
+@@ -1398,12 +1405,6 @@ void generate_files(int f_out, struct fi
: "enabled");
}
for (i = 0; i < flist->count; i++) {
struct file_struct *file = flist->files[i];
-@@ -1442,23 +1443,34 @@ void generate_files(int f_out, struct fi
+@@ -1447,23 +1448,34 @@ void generate_files(int f_out, struct fi
delete_in_dir(NULL, NULL, NULL, NULL);
phase++;
if (local_name)
strlcpy(fbuf, local_name, sizeof fbuf);
else
-@@ -1470,27 +1482,43 @@ void generate_files(int f_out, struct fi
+@@ -1475,27 +1487,43 @@ void generate_files(int f_out, struct fi
phase++;
ignore_non_existing = save_ignore_non_existing;
ignore_existing = save_ignore_existing;
if (io_filesfrom_f_out >= 0) {
if (io_filesfrom_buflen) {
if (FD_ISSET(io_filesfrom_f_out, &w_fds)) {
-@@ -841,6 +791,8 @@ static void readfd(int fd, char *buffer,
+@@ -847,6 +797,8 @@ static void readfd(int fd, char *buffer,
}
if (fd == write_batch_monitor_in) {
if ((size_t)write(batch_fd, buffer, total) != total)
exit_cleanup(RERR_FILEIO);
}
-@@ -1102,7 +1054,6 @@ static void writefd_unbuffered(int fd,ch
+@@ -1115,7 +1067,6 @@ static void writefd_unbuffered(int fd,ch
* to grab any messages they sent before they died. */
while (fd == sock_f_out && io_multiplexing_in) {
set_io_timeout(30);
readfd_unbuffered(sock_f_in, io_filesfrom_buf,
sizeof io_filesfrom_buf);
}
-@@ -1113,7 +1064,7 @@ static void writefd_unbuffered(int fd,ch
+@@ -1126,7 +1077,7 @@ static void writefd_unbuffered(int fd,ch
defer_forwarding_messages = 1;
if (fd == sock_f_out) {
last_io_out = time(NULL);
sleep_for_bwlimit(cnt);
}
-@@ -1123,23 +1074,6 @@ static void writefd_unbuffered(int fd,ch
+@@ -1136,23 +1087,6 @@ static void writefd_unbuffered(int fd,ch
no_flush--;
}
/**
* Write an message to a multiplexed stream. If this fails then rsync
* exits.
-@@ -1165,14 +1099,15 @@ static void mplex_write(enum msgcode cod
+@@ -1178,14 +1112,15 @@ static void mplex_write(enum msgcode cod
defer_forwarding_messages = 1;
writefd_unbuffered(sock_f_out, buf, len);
defer_forwarding_messages = 0;
if (!iobuf_out_cnt || no_flush)
return;
-@@ -1186,11 +1121,6 @@ void io_flush(int flush_it_all)
+@@ -1199,11 +1134,6 @@ void io_flush(int flush_it_all)
static void writefd(int fd,char *buf,size_t len)
{
if (fd == sock_f_out)
stats.total_written += len;
-@@ -1396,9 +1326,3 @@ void start_write_batch(int fd)
+@@ -1409,9 +1339,3 @@ void start_write_batch(int fd)
else
write_batch_monitor_in = fd;
}
extern int allow_8bit_chars;
extern int protocol_version;
extern int preserve_times;
-@@ -75,7 +74,6 @@ struct {
+@@ -76,7 +75,6 @@ struct {
{ RERR_IPC , "error in IPC code" },
{ RERR_CRASHED , "sibling process crashed" },
{ RERR_TERMINATED , "sibling process terminated abnormally" },
{ RERR_SIGNAL , "received SIGINT, SIGTERM, or SIGHUP" },
{ RERR_WAITCHILD , "waitpid() failed" },
{ RERR_MALLOC , "error allocating core memory buffers" },
-@@ -242,8 +240,8 @@ void rwrite(enum logcode code, char *buf
+@@ -250,8 +248,8 @@ void rwrite(enum logcode code, char *buf
if (len < 0)
- exit_cleanup(RERR_MESSAGEIO);
+ EXIT_OR_RETURN(RERR_MESSAGEIO);
- if (am_server && msg_fd_out >= 0) {
- /* Pass the message to our sibling. */
extern int am_daemon;
extern int blocking_io;
extern int remove_source_files;
-@@ -93,9 +92,20 @@ struct pid_status {
+@@ -96,9 +95,20 @@ struct pid_status {
static time_t starttime, endtime;
static int64 total_read, total_written;
/* Works like waitpid(), but if we already harvested the child pid in our
* remember_children(), we succeed instead of returning an error. */
pid_t wait_process(pid_t pid, int *status_ptr, int flags)
-@@ -172,7 +182,7 @@ static void handle_stats(int f)
+@@ -175,7 +185,7 @@ static void handle_stats(int f)
show_flist_stats();
}
return;
if (am_daemon) {
-@@ -658,12 +668,30 @@ static void do_server_sender(int f_in, i
+@@ -683,12 +693,30 @@ static void do_server_sender(int f_in, i
exit_cleanup(0);
}
/* The receiving side mustn't obey this, or an existing symlink that
* points to an identical file won't be replaced by the referent. */
-@@ -672,70 +700,16 @@ static int do_recv(int f_in,int f_out,st
+@@ -697,70 +725,16 @@ static int do_recv(int f_in,int f_out,st
if (preserve_hard_links)
init_hard_links();
generate_files(f_out, flist, local_name);
handle_stats(-1);
-@@ -746,10 +720,13 @@ static int do_recv(int f_in,int f_out,st
+@@ -771,10 +745,13 @@ static int do_recv(int f_in,int f_out,st
}
io_flush(FULL_FLUSH);
}
-@@ -1151,22 +1128,6 @@ static int start_client(int argc, char *
+@@ -1176,22 +1153,6 @@ static int start_client(int argc, char *
return ret;
}
RETSIGTYPE remember_children(UNUSED(int val))
{
#ifdef WNOHANG
-@@ -1258,8 +1219,6 @@ int main(int argc,char *argv[])
+@@ -1283,8 +1244,6 @@ int main(int argc,char *argv[])
# endif
sigact.sa_flags = SA_NOCLDSTOP;
#endif
int keep_partial = 0;
int safe_symlinks = 0;
int copy_unsafe_links = 0;
-@@ -1305,6 +1305,7 @@ int parse_arguments(int *argc, const cha
+@@ -1299,6 +1299,7 @@ int parse_arguments(int *argc, const cha
if (do_progress && !verbose && !log_before_transfer && !am_server)
verbose = 1;
extern int log_before_transfer;
extern int stdout_format_has_i;
extern int logfile_format_has_i;
-@@ -154,7 +154,7 @@ static int receive_data(int f_in, char *
+@@ -157,7 +157,7 @@ static int receive_data(int f_in, char *
if (sum.remainder)
sum.flength -= sum.blength - sum.remainder;
for (j = CHUNK_SIZE; j < sum.flength; j += CHUNK_SIZE) {
show_progress(offset, total_size);
sum_update(map_ptr(mapbuf, offset, CHUNK_SIZE),
CHUNK_SIZE);
-@@ -162,7 +162,7 @@ static int receive_data(int f_in, char *
+@@ -165,7 +165,7 @@ static int receive_data(int f_in, char *
}
if (offset < sum.flength) {
int32 len = sum.flength - offset;
show_progress(offset, total_size);
sum_update(map_ptr(mapbuf, offset, len), len);
offset = sum.flength;
-@@ -175,7 +175,7 @@ static int receive_data(int f_in, char *
+@@ -178,7 +178,7 @@ static int receive_data(int f_in, char *
}
while ((i = recv_token(f_in, &data)) != 0) {
show_progress(offset, total_size);
if (i > 0) {
-@@ -245,7 +245,7 @@ static int receive_data(int f_in, char *
+@@ -248,7 +248,7 @@ static int receive_data(int f_in, char *
ftruncate(fd, offset);
#endif
end_progress(total_size);
if (fd != -1 && offset > 0 && sparse_end(fd) != 0) {
-@@ -296,12 +296,12 @@ static void handle_delayed_updates(struc
+@@ -299,12 +299,12 @@ static void handle_delayed_updates(struc
"rename failed for %s (from %s)",
full_fname(fname), partialptr);
} else {
handle_partial_dir(partialptr, PDIR_DELETE);
}
}
-@@ -352,11 +352,6 @@ int recv_files(int f_in, struct file_lis
+@@ -355,11 +355,6 @@ int recv_files(int f_in, struct file_lis
if (verbose > 2)
rprintf(FINFO,"recv_files(%d) starting\n",flist->count);
if (delay_updates)
delayed_bits = bitbag_create(flist->count);
-@@ -377,7 +372,7 @@ int recv_files(int f_in, struct file_lis
+@@ -382,7 +377,7 @@ int recv_files(int f_in, struct file_lis
rprintf(FINFO, "recv_files phase=%d\n", phase);
if (phase == 2 && delay_updates)
handle_delayed_updates(flist, local_name);
if (keep_partial && !partial_dir)
make_backups = 0; /* prevents double backup */
if (append_mode) {
-@@ -597,7 +592,7 @@ int recv_files(int f_in, struct file_lis
+@@ -607,7 +602,7 @@ int recv_files(int f_in, struct file_lis
/* log the transfer */
if (log_before_transfer)
log_item(FCLIENT, file, &initial_stats, iflags, NULL);
rprintf(FINFO, "%s\n", fname);
/* recv file data */
-@@ -644,11 +639,13 @@ int recv_files(int f_in, struct file_lis
+@@ -654,11 +649,13 @@ int recv_files(int f_in, struct file_lis
cleanup_disable();
if (recv_ok > 0) {
} else if (!recv_ok) {
int msgtype = phase || read_batch ? FERROR : FINFO;
if (msgtype == FERROR || verbose) {
-@@ -671,8 +668,8 @@ int recv_files(int f_in, struct file_lis
+@@ -681,8 +678,8 @@ int recv_files(int f_in, struct file_lis
errstr, fname, keptstr, redostr);
}
if (!phase) {
extern int am_starting_up;
extern int allow_8bit_chars;
extern int preserve_uid;
-@@ -300,5 +299,5 @@ const char *who_am_i(void)
+@@ -305,5 +304,5 @@ const char *who_am_i(void)
{
if (am_starting_up)
return am_server ? "server" : "client";
};
#include "errcode.h"
-@@ -323,6 +321,7 @@ enum msgcode {
+@@ -329,6 +327,7 @@ enum msgcode {
#endif
#include <assert.h>