diff --git a/rsync.c b/rsync.c
--- a/rsync.c
+++ b/rsync.c
-@@ -380,6 +380,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -383,6 +383,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
int updated = 0;
stat_x sx2;
int change_uid, change_gid;
mode_t new_mode = file->mode;
int inherit;
-@@ -423,20 +424,38 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -426,20 +427,38 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
set_xattr(fname, file, fnamecmp, sxp);
#endif
}
change_uid = am_root && uid_ndx && sxp->st.st_uid != (uid_t)F_OWNER(file);
-@@ -570,7 +589,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
+@@ -573,7 +592,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
/* Change permissions before putting the file into place. */
set_file_attrs(fnametmp, file, NULL, fnamecmp,
/* move tmp file over real file */
if (verbose > 2)
-@@ -597,7 +616,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
+@@ -600,7 +619,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
do_set_file_attrs:
set_file_attrs(fnametmp, file, NULL, fnamecmp,
if (make_backups && !backup_dir) {
omit_dir_times = 0; /* Implied, so avoid -O to sender. */
-@@ -1915,6 +1977,10 @@ void server_options(char **args, int *argc_p)
+@@ -1916,6 +1978,10 @@ void server_options(char **args, int *argc_p)
args[ac++] = "--backup-dir";
args[ac++] = backup_dir;
}
/* Only send --suffix if it specifies a non-default value. */
if (strcmp(backup_suffix, backup_dir ? "" : BACKUP_SUFFIX) != 0) {
-@@ -1923,7 +1989,14 @@ void server_options(char **args, int *argc_p)
+@@ -1924,7 +1990,14 @@ void server_options(char **args, int *argc_p)
goto oom;
args[ac++] = arg;
}
extern int io_timeout;
extern int no_detach;
extern int write_batch;
-@@ -780,6 +782,9 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
+@@ -778,6 +780,9 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
} else if (am_root < 0) /* Treat --fake-super from client as --super. */
am_root = 2;
diff --git a/hlink.c b/hlink.c
--- a/hlink.c
+++ b/hlink.c
-@@ -386,7 +386,7 @@ int hard_link_check(struct file_struct *file, int ndx, const char *fname,
+@@ -390,7 +390,7 @@ int hard_link_check(struct file_struct *file, int ndx, const char *fname,
}
break;
}
/* Some utility defines: */
#define F_IS_ACTIVE(f) (f)->basename[0]
#define F_IS_HLINKED(f) ((f)->flags & FLAG_HLINKED)
-@@ -870,6 +874,13 @@ typedef struct {
+@@ -879,6 +883,13 @@ typedef struct {
char fname[1]; /* has variable size */
} relnamecache;
}
for (i = cur_flist->low; i <= cur_flist->high; i++) {
struct file_struct *file = cur_flist->sorted[i];
-@@ -2332,6 +2338,9 @@ void generate_files(int f_out, const char *local_name)
+@@ -2335,6 +2341,9 @@ void generate_files(int f_out, const char *local_name)
wait_for_receiver();
}
extern int protocol_version;
extern int remove_source_files;
extern int preserve_hard_links;
-@@ -203,6 +204,9 @@ static void got_flist_entry_status(enum festatus status, const char *buf)
+@@ -161,6 +162,9 @@ static void got_flist_entry_status(enum festatus status, const char *buf)
flist_ndx_push(&hlink_list, ndx);
flist->in_progress++;
}
extern int inplace;
extern int delay_updates;
extern mode_t orig_umask;
-@@ -339,7 +340,7 @@ static void handle_delayed_updates(char *local_name)
+@@ -340,7 +341,7 @@ static void handle_delayed_updates(char *local_name)
"rename failed for %s (from %s)",
full_fname(fname), partialptr);
} else {
|| (preserve_hard_links && F_IS_HLINKED(file)))
send_msg_int(MSG_SUCCESS, ndx);
handle_partial_dir(partialptr, PDIR_DELETE);
-@@ -723,7 +724,7 @@ int recv_files(int f_in, char *local_name)
+@@ -755,7 +756,7 @@ int recv_files(int f_in, char *local_name)
case 2:
break;
case 1:
diff --git a/rsync.h b/rsync.h
--- a/rsync.h
+++ b/rsync.h
-@@ -876,6 +876,8 @@ typedef struct {
+@@ -885,6 +885,8 @@ typedef struct {
#define CSF_ENABLE (1<<1)
#define CSF_LAX (1<<2)
{"specials", 0, POPT_ARG_VAL, &preserve_specials, 1, 0, 0 },
{"no-specials", 0, POPT_ARG_VAL, &preserve_specials, 0, 0, 0 },
{"links", 'l', POPT_ARG_VAL, &preserve_links, 1, 0, 0 },
-@@ -2061,6 +2064,9 @@ void server_options(char **args, int *argc_p)
+@@ -2062,6 +2065,9 @@ void server_options(char **args, int *argc_p)
else if (remove_source_files)
args[ac++] = "--remove-sent-files";
extern int am_root;
extern int am_server;
extern int am_sender;
-@@ -326,7 +327,8 @@ int read_ndx_and_attrs(int f_in, int *iflag_ptr, uchar *type_ptr,
+@@ -329,7 +330,8 @@ int read_ndx_and_attrs(int f_in, int *iflag_ptr, uchar *type_ptr,
if (iflags & ITEM_TRANSFER) {
int i = ndx - cur_flist->ndx_start;
exit_cleanup(RERR_PROTOCOL);
}
-+ /* On Matt's computer, st_size is falsely 0 for most devices.
-+ * If this happens, try harder to determine the actual device size. */
++ /* On Linux systems (at least), st_size is typically 0 for devices.
++ * If so, try to determine the actual device size. */
+ if (IS_DEVICE(st.st_mode) && st.st_size == 0) {
+ OFF_T off = lseek(fd, 0, SEEK_END);
+ if (off == (OFF_T) -1)
{"one-file-system", 'x', POPT_ARG_NONE, 0, 'x', 0, 0 },
{"no-one-file-system",'x',POPT_ARG_VAL, &one_file_system, 0, 0, 0 },
{"no-x", 'x', POPT_ARG_VAL, &one_file_system, 0, 0, 0 },
-@@ -1967,6 +1970,9 @@ void server_options(char **args, int *argc_p)
+@@ -1968,6 +1971,9 @@ void server_options(char **args, int *argc_p)
}
}
extern char *bind_address;
extern char *sockopts;
extern char *config_file;
-@@ -552,6 +555,9 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
+@@ -564,6 +567,9 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
log_init(1);
#ifdef HAVE_PUTENV
if (*lp_prexfer_exec(i) || *lp_postxfer_exec(i)) {
char *modname, *modpath, *hostaddr, *hostname, *username;
-@@ -768,6 +774,10 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
+@@ -766,6 +772,10 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
am_server = 1; /* Don't let someone try to be tricky. */
quiet = 0;
{"fuzzy", 'y', POPT_ARG_VAL, &fuzzy_basis, 1, 0, 0 },
{"no-fuzzy", 0, POPT_ARG_VAL, &fuzzy_basis, 0, 0, 0 },
{"no-y", 0, POPT_ARG_VAL, &fuzzy_basis, 0, 0, 0 },
-@@ -1963,8 +1967,14 @@ void server_options(char **args, int *argc_p)
+@@ -1964,8 +1968,14 @@ void server_options(char **args, int *argc_p)
args[ac++] = "--super";
if (size_only)
args[ac++] = "--size-only";
} else
change_local_filter_dir(fbuf, strlen(fbuf), F_DEPTH(fp));
}
-@@ -2283,7 +2447,21 @@ void generate_files(int f_out, const char *local_name)
- } while ((cur_flist = cur_flist->next) != NULL);
+@@ -2286,7 +2450,21 @@ void generate_files(int f_out, const char *local_name)
+ write_ndx(f_out, NDX_DONE);
if (delete_during)
- delete_in_dir(NULL, NULL, &dev_zero);
delay_updates ? "delay-updates" : "partial-dir");
return 0;
}
-@@ -1959,6 +1963,8 @@ void server_options(char **args, int *argc_p)
+@@ -1960,6 +1964,8 @@ void server_options(char **args, int *argc_p)
args[ac++] = "--super";
if (size_only)
args[ac++] = "--size-only";
diff --git a/util.c b/util.c
--- a/util.c
+++ b/util.c
-@@ -1129,6 +1129,32 @@ int handle_partial_dir(const char *fname, int create)
+@@ -1157,6 +1157,32 @@ int handle_partial_dir(const char *fname, int create)
return 1;
}
diff --git a/clientserver.c b/clientserver.c
--- a/clientserver.c
+++ b/clientserver.c
-@@ -1043,6 +1043,7 @@ int daemon_main(void)
+@@ -1041,6 +1041,7 @@ int daemon_main(void)
fprintf(stderr, "Failed to parse config file: %s\n", config_file);
exit_cleanup(RERR_SYNTAX);
}
diff --git a/receiver.c b/receiver.c
--- a/receiver.c
+++ b/receiver.c
-@@ -62,6 +62,10 @@ static int phase = 0, redoing = 0;
+@@ -63,6 +63,10 @@ static flist_ndx_list batch_redo_list;
/* We're either updating the basis file or an identical copy: */
static int updating_basis_or_equiv;
{"ignore-errors", 0, POPT_ARG_VAL, &ignore_errors, 1, 0, 0 },
{"no-ignore-errors", 0, POPT_ARG_VAL, &ignore_errors, 0, 0, 0 },
{"max-delete", 0, POPT_ARG_INT, &max_delete, 0, 0, 0 },
-@@ -1866,6 +1892,9 @@ void server_options(char **args, int *argc_p)
+@@ -1867,6 +1893,9 @@ void server_options(char **args, int *argc_p)
if (xfer_dirs && !recurse && delete_mode && am_sender)
args[ac++] = "--no-r";
if (do_compression && def_compress_level != Z_DEFAULT_COMPRESSION) {
if (asprintf(&arg, "--compress-level=%d", def_compress_level) < 0)
goto oom;
-@@ -1953,6 +1982,16 @@ void server_options(char **args, int *argc_p)
+@@ -1954,6 +1983,16 @@ void server_options(char **args, int *argc_p)
args[ac++] = "--delete-excluded";
if (force_delete)
args[ac++] = "--force";
extern int preserve_executability;
extern int preserve_times;
extern int am_root;
-@@ -374,6 +375,39 @@ mode_t dest_mode(mode_t flist_mode, mode_t stat_mode, int dflt_perms,
+@@ -377,6 +378,39 @@ 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)
{
-@@ -427,7 +461,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -430,7 +464,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
flags |= ATTRS_SKIP_MTIME;
if (!(flags & ATTRS_SKIP_MTIME)
&& cmp_time(sxp->st.st_mtime, file->modtime) != 0) {
if (ret < 0) {
rsyserr(FERROR_XFER, errno, "failed to set times on %s",
full_fname(fname));
-@@ -463,7 +497,8 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -466,7 +500,8 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
if (am_root >= 0) {
if (do_lchown(fname,
change_uid ? (uid_t)F_OWNER(file) : sxp->st.st_uid,
/* We shouldn't have attempted to change uid
* or gid unless have the privilege. */
rsyserr(FERROR_XFER, errno, "%s %s failed",
-@@ -495,7 +530,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -498,7 +533,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
#ifdef HAVE_CHMOD
if (!BITS_EQUAL(sxp->st.st_mode, new_mode, CHMOD_BITS)) {
if (ret < 0) {
rsyserr(FERROR_XFER, errno,
"failed to set permissions on %s",
-@@ -507,6 +542,19 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -510,6 +545,19 @@ 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);
-@@ -570,7 +618,8 @@ int finish_transfer(const char *fname, const char *fnametmp,
+@@ -573,7 +621,8 @@ int finish_transfer(const char *fname, const char *fnametmp,
/* Change permissions before putting the file into place. */
set_file_attrs(fnametmp, file, NULL, fnamecmp,
/* move tmp file over real file */
if (verbose > 2)
-@@ -589,6 +638,10 @@ int finish_transfer(const char *fname, const char *fnametmp,
+@@ -592,6 +641,10 @@ int finish_transfer(const char *fname, const char *fnametmp,
}
if (ret == 0) {
/* The file was moved into place (not copied), so it's done. */
{"rsh", 'e', POPT_ARG_STRING, &shell_cmd, 0, 0, 0 },
{"rsync-path", 0, POPT_ARG_STRING, &rsync_path, 0, 0, 0 },
{"temp-dir", 'T', POPT_ARG_STRING, &tmpdir, 0, 0, 0 },
-@@ -2017,6 +2020,9 @@ void server_options(char **args, int *argc_p)
+@@ -2018,6 +2021,9 @@ void server_options(char **args, int *argc_p)
args[ac++] = tmpdir;
}
extern int basis_dir_cnt;
extern int make_backups;
extern int cleanup_got_literal;
-@@ -298,6 +299,12 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
+@@ -299,6 +300,12 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
exit_cleanup(RERR_FILEIO);
}
{"files-from", 0, POPT_ARG_STRING, &files_from, 0, 0, 0 },
{"from0", '0', POPT_ARG_VAL, &eol_nulls, 1, 0, 0},
{"no-from0", 0, POPT_ARG_VAL, &eol_nulls, 0, 0, 0},
-@@ -1979,6 +1983,9 @@ void server_options(char **args, int *argc_p)
+@@ -1980,6 +1984,9 @@ void server_options(char **args, int *argc_p)
args[ac++] = arg;
}
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -2036,6 +2054,11 @@ void server_options(char **args, int *argc_p)
+@@ -2037,6 +2055,11 @@ void server_options(char **args, int *argc_p)
} else if (inplace)
args[ac++] = "--inplace";
diff --git a/receiver.c b/receiver.c
--- a/receiver.c
+++ b/receiver.c
-@@ -162,12 +162,14 @@ int open_tmpfile(char *fnametmp, const char *fname, struct file_struct *file)
+@@ -163,12 +163,14 @@ int open_tmpfile(char *fnametmp, const char *fname, struct file_struct *file)
}
static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
int32 len, sum_len;
OFF_T offset = 0;
OFF_T offset2;
-@@ -187,6 +189,9 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
+@@ -188,6 +190,9 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
} else
mapbuf = NULL;
sum_init(checksum_seed);
if (append_mode > 0) {
-@@ -231,6 +236,8 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
+@@ -232,6 +237,8 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
cleanup_got_literal = 1;
sum_update(data, i);
if (fd != -1 && write_file(fd,data,i) != i)
goto report_write_error;
-@@ -257,6 +264,8 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
+@@ -258,6 +265,8 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
see_token(map, len);
sum_update(map, len);
}
if (updating_basis_or_equiv) {
-@@ -299,6 +308,8 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
+@@ -300,6 +309,8 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
}
sum_len = sum_end(file_sum1);
if (mapbuf)
unmap_file(mapbuf);
-@@ -314,7 +325,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
+@@ -315,7 +326,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
static void discard_receive_data(int f_in, OFF_T length)
{
}
static void handle_delayed_updates(char *local_name)
-@@ -676,7 +687,7 @@ int recv_files(int f_in, char *local_name)
+@@ -705,7 +716,7 @@ int recv_files(int f_in, char *local_name)
/* recv file data */
recv_ok = receive_data(f_in, fnamecmp, fd1, st.st_size,
extern struct file_list *cur_flist, *first_flist, *dir_flist;
extern struct chmod_mode_struct *daemon_chmod_modes;
#ifdef ICONV_OPTION
-@@ -575,8 +576,15 @@ int finish_transfer(const char *fname, const char *fnametmp,
+@@ -578,8 +579,15 @@ int finish_transfer(const char *fname, const char *fnametmp,
/* move tmp file over real file */
if (verbose > 2)
rprintf(FINFO, "renaming %s to %s\n", fnametmp, fname);
+
struct chmod_mode_struct;
- #define EMPTY_ITEM_LIST {NULL, 0, 0}
+ struct flist_ndx_item {
diff --git a/rsync.yo b/rsync.yo
--- a/rsync.yo
+++ b/rsync.yo
extern int gid_ndx;
@@ -57,6 +59,7 @@ extern iconv_t ic_send, ic_recv;
extern char curr_dir[];
- extern char *module_dir;
+ extern char *full_module_path;
extern unsigned int module_dirlen;
+extern char sender_file_sum[MAX_DIGEST_LEN];
extern struct file_list *cur_flist, *first_flist, *dir_flist;
extern struct filter_list_struct daemon_filter_list;
-@@ -165,10 +167,9 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
+@@ -166,10 +168,9 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
const char *fname, int fd, OFF_T total_size)
{
static char file_sum1[MAX_DIGEST_LEN];
OFF_T offset = 0;
OFF_T offset2;
char *data;
-@@ -298,15 +299,16 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
+@@ -299,15 +300,16 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
exit_cleanup(RERR_FILEIO);
}
struct chmod_mode_struct *daemon_chmod_modes;
/* module_dirlen is the length of the module_dir string when in daemon
-@@ -406,6 +406,7 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
+@@ -418,6 +418,7 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
char *name = lp_name(i);
int use_chroot = lp_use_chroot(i);
int ret, pre_exec_fd = -1;
pid_t pre_exec_pid = 0;
char *request = NULL;
-@@ -689,9 +690,11 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
+@@ -687,9 +688,11 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
munge_symlinks = !use_chroot || module_dirlen;
if (munge_symlinks) {
STRUCT_STAT st;
io_printf(f_out, "@ERROR: daemon security issue -- contact admin\n", name);
exit_cleanup(RERR_UNSUPPORTED);
}
-@@ -747,6 +750,8 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
+@@ -745,6 +748,8 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
read_args(f_in, name, line, sizeof line, rl_nulls, &argv, &argc, &request);
orig_argv = argv;
verbose = 0; /* future verbosity is controlled by client options */
ret = parse_arguments(&argc, (const char ***) &argv);
if (protect_args && ret) {
-@@ -758,6 +763,8 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
+@@ -756,6 +761,8 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
} else
orig_early_argv = NULL;
struct chmod_mode_struct *daemon_chmod_modes;
/* module_dirlen is the length of the module_dir string when in daemon
-@@ -76,6 +77,7 @@ char *module_dir = NULL;
- unsigned int module_dirlen = 0;
+@@ -78,6 +79,7 @@ unsigned int module_dirlen = 0;
+ char *full_module_path;
static int rl_nulls = 0;
+static int namecvt_fd_req = -1, namecvt_fd_ans = -1;
#ifdef HAVE_SIGACTION
static struct sigaction sigact;
-@@ -553,7 +555,7 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
+@@ -565,7 +567,7 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
log_init(1);
#ifdef HAVE_PUTENV
char *modname, *modpath, *hostaddr, *hostname, *username;
int status;
-@@ -649,6 +651,44 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
+@@ -653,6 +655,44 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
set_blocking(fds[1]);
pre_exec_fd = fds[1];
}
umask(0);
}
#endif
-@@ -878,6 +918,44 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
+@@ -876,6 +916,44 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
return 0;
}
extern int am_root;
extern int am_server;
extern int am_sender;
-@@ -439,9 +440,11 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
+@@ -442,9 +443,11 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
file->flags |= FLAG_TIME_FAILED;
}
extern int rsync_port;
extern int protect_args;
extern int ignore_errors;
-@@ -126,8 +129,18 @@ int start_socket_client(char *host, int remote_argc, char *remote_argv[],
+@@ -128,8 +131,18 @@ int start_socket_client(char *host, int remote_argc, char *remote_argv[],
#endif
ret = start_inband_exchange(fd, fd, user, remote_argc, remote_argv);
}
static int exchange_protocols(int f_in, int f_out, char *buf, size_t bufsiz, int am_client)
-@@ -270,6 +283,32 @@ int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char
+@@ -272,6 +285,32 @@ int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char
if (verbose > 1)
print_child_argv("sending daemon args:", sargs);
io_printf(f_out, "%.*s\n", modlen, modname);
/* Old servers may just drop the connection here,
-@@ -295,6 +334,10 @@ int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char
+@@ -297,6 +336,10 @@ int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char
* server to terminate the listing of modules.
* We don't want to go on and transfer
* anything; just exit. */
exit(0);
}
-@@ -302,6 +345,10 @@ int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char
+@@ -304,6 +347,10 @@ int start_inband_exchange(int f_in, int f_out, const char *user, int argc, char
rprintf(FERROR, "%s\n", line);
/* This is always fatal; the server will now
* close the socket. */
return -1;
}
-@@ -935,6 +982,9 @@ int start_daemon(int f_in, int f_out)
+@@ -933,6 +980,9 @@ int start_daemon(int f_in, int f_out)
if (exchange_protocols(f_in, f_out, line, sizeof line, 0) < 0)
return -1;
line[0] = 0;
if (!read_line_old(f_in, line, sizeof line))
return -1;
-@@ -946,6 +996,20 @@ int start_daemon(int f_in, int f_out)
+@@ -944,6 +994,20 @@ int start_daemon(int f_in, int f_out)
return -1;
}
if (inplace) {
#ifdef HAVE_FTRUNCATE
if (partial_dir) {
-@@ -2085,10 +2159,27 @@ char *check_for_hostspec(char *s, char **host_ptr, int *port_ptr)
+@@ -2086,10 +2160,27 @@ char *check_for_hostspec(char *s, char **host_ptr, int *port_ptr)
char *p;
int not_host;
int hostlen;
{"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 },
-@@ -2061,6 +2070,9 @@ void server_options(char **args, int *argc_p)
+@@ -2062,6 +2071,9 @@ void server_options(char **args, int *argc_p)
else if (remove_source_files)
args[ac++] = "--remove-sent-files";
extern int keep_partial;
extern int checksum_seed;
extern int inplace;
-@@ -174,6 +175,18 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
+@@ -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;
char *map = NULL;
read_sum_head(f_in, &sum);
-@@ -284,8 +297,18 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
+@@ -285,8 +298,18 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
goto report_write_error;
#ifdef HAVE_FTRUNCATE
case OPT_WRITE_BATCH:
/* batch_name is already set */
write_batch = 1;
-@@ -1840,6 +1866,11 @@ void server_options(char **args, int *argc_p)
-
- argstr[x] = '\0';
-
-+ if (x > (int)sizeof argstr) { /* Not possible... */
-+ rprintf(FERROR, "argstr overflow in server_options().\n");
-+ exit_cleanup(RERR_MALLOC);
-+ }
-+
- args[ac++] = argstr;
-
- #ifdef ICONV_OPTION
-@@ -2061,6 +2092,16 @@ void server_options(char **args, int *argc_p)
+@@ -2062,6 +2088,16 @@ void server_options(char **args, int *argc_p)
else if (remove_source_files)
args[ac++] = "--remove-sent-files";
diff --git a/clientserver.c b/clientserver.c
--- a/clientserver.c
+++ b/clientserver.c
-@@ -1062,6 +1062,13 @@ int daemon_main(void)
+@@ -1060,6 +1060,13 @@ int daemon_main(void)
* address too. In fact, why not just do inet_ntop on the
* local address??? */
{"no-backup", 0, POPT_ARG_VAL, &make_backups, 0, 0, 0 },
{"backup-dir", 0, POPT_ARG_STRING, &backup_dir, 0, 0, 0 },
{"suffix", 0, POPT_ARG_STRING, &backup_suffix, 0, 0, 0 },
-@@ -1965,6 +1968,8 @@ void server_options(char **args, int *argc_p)
+@@ -1966,6 +1969,8 @@ void server_options(char **args, int *argc_p)
goto oom;
args[ac++] = arg;
}
if (files_from) {
char *h, *p;
int q;
-@@ -1967,6 +1986,25 @@ void server_options(char **args, int *argc_p)
+@@ -1968,6 +1987,25 @@ void server_options(char **args, int *argc_p)
}
}
extern char *partial_dir;
extern char *basis_dir[];
extern struct file_list *cur_flist, *first_flist, *dir_flist;
-@@ -395,6 +396,8 @@ int recv_files(int f_in, char *local_name)
+@@ -430,6 +431,8 @@ int recv_files(int f_in, char *local_name)
const char *parent_dirname = "";
#endif
int ndx, recv_ok;
if (verbose > 2)
rprintf(FINFO, "recv_files(%d) starting\n", cur_flist->used);
-@@ -402,6 +405,23 @@ int recv_files(int f_in, char *local_name)
+@@ -437,6 +440,23 @@ int recv_files(int f_in, char *local_name)
if (delay_updates)
delayed_bits = bitbag_create(cur_flist->used + 1);
while (1) {
cleanup_disable();
-@@ -674,6 +694,9 @@ int recv_files(int f_in, char *local_name)
+@@ -703,6 +723,9 @@ int recv_files(int f_in, char *local_name)
else if (!am_server && verbose && do_progress)
rprintf(FINFO, "%s\n", fname);
/* recv file data */
recv_ok = receive_data(f_in, fnamecmp, fd1, st.st_size,
fname, fd2, F_LENGTH(file));
-@@ -688,6 +711,16 @@ int recv_files(int f_in, char *local_name)
+@@ -717,6 +740,16 @@ int recv_files(int f_in, char *local_name)
exit_cleanup(RERR_FILEIO);
}
{"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 },
-@@ -1899,6 +1902,12 @@ void server_options(char **args, int *argc_p)
+@@ -1900,6 +1903,12 @@ void server_options(char **args, int *argc_p)
args[ac++] = arg;
}
extern struct file_list *cur_flist;
#ifdef ICONV_OPTION
extern int filesfrom_convert;
-@@ -219,16 +220,24 @@ static void check_timeout(void)
+@@ -182,16 +183,24 @@ static void check_timeout(void)
{
time_t t;
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -1911,6 +1946,15 @@ void server_options(char **args, int *argc_p)
+@@ -1912,6 +1947,15 @@ void server_options(char **args, int *argc_p)
args[ac++] = arg;
}
am_starting_up = 0;
return 1;
-@@ -2061,6 +2090,12 @@ void server_options(char **args, int *argc_p)
+@@ -2062,6 +2091,12 @@ void server_options(char **args, int *argc_p)
else if (remove_source_files)
args[ac++] = "--remove-sent-files";
case OPT_HELP:
usage(FINFO);
exit_cleanup(0);
-@@ -2005,6 +2050,18 @@ void server_options(char **args, int *argc_p)
+@@ -2006,6 +2051,18 @@ void server_options(char **args, int *argc_p)
args[ac++] = "--use-qsort";
if (am_sender) {