extern int dry_run;
extern int list_only;
+extern int io_timeout;
extern int am_root;
extern int am_server;
extern int am_sender;
extern int got_xfer_error;
extern int msgs2stderr;
extern int module_id;
+extern int read_only;
extern int copy_links;
extern int copy_dirlinks;
extern int copy_unsafe_links;
extern pid_t cleanup_child_pid;
extern size_t bwlimit_writemax;
extern unsigned int module_dirlen;
+extern BOOL flist_receiving_enabled;
+extern BOOL shutting_down;
extern struct stats stats;
extern char *stdout_format;
extern char *logfile_format;
int *f_in_p, int *f_out_p)
{
int i, argc = 0;
- char *args[MAX_ARGS];
+ char *args[MAX_ARGS], *need_to_free = NULL;
pid_t pid;
int dash_l_set = 0;
cmd = rsh_env;
if (!cmd)
cmd = RSYNC_RSH;
- cmd = strdup(cmd); /* MEMORY LEAK */
+ cmd = need_to_free = strdup(cmd);
if (!cmd)
goto oom;
send_protected_args(*f_out_p, args);
}
+ if (need_to_free)
+ free(need_to_free);
+
return pid;
oom:
uchar fnamecmp_type;
char xname[MAXPATHLEN];
+ shutting_down = True;
+
if (protocol_version < 29)
i = read_int(f_in);
else {
exit_cleanup(RERR_SYNTAX);
return;
}
- if (am_daemon && lp_read_only(module_id) && remove_source_files) {
+ if (am_daemon && read_only && remove_source_files) {
rprintf(FERROR,
"ERROR: --remove-%s-files cannot be used with a read-only module\n",
remove_source_files == 1 ? "source" : "sent");
close(error_pipe[0]);
/* We can't let two processes write to the socket at one time. */
- io_end_multiplex_out(False);
+ io_end_multiplex_out(MPLX_SWITCHING);
if (f_in != f_out)
close(f_out);
sock_f_out = -1;
}
am_generator = 1;
+ flist_receiving_enabled = True;
- io_end_multiplex_in(False);
+ io_end_multiplex_in(MPLX_SWITCHING);
if (write_batch && !am_server)
stop_write_batch();
handle_stats(-1);
io_flush(FULL_FLUSH);
+ shutting_down = True;
if (protocol_version >= 24) {
/* send a final goodbye message */
write_ndx(f_out, NDX_DONE);
argc, (long)getpid());
}
- if (am_daemon && lp_read_only(module_id)) {
+ if (am_daemon && read_only) {
rprintf(FERROR,"ERROR: module is read only\n");
exit_cleanup(RERR_SYNTAX);
return;
if (protocol_version >= 23)
io_start_multiplex_out(f_out);
+ if (am_daemon && io_timeout && protocol_version >= 31)
+ send_msg_int(MSG_IO_TIMEOUT, io_timeout);
if (am_sender) {
keep_dirlinks = 0; /* Must be disabled on the sender. */
if (need_messages_from_generator)
io_start_multiplex_in(f_in);
+ else
+ io_start_buffering_in(f_in);
recv_filter_list(f_in);
do_server_sender(f_in, f_out, argc, argv);
} else
io_start_buffering_out(f_out);
if (protocol_version >= 31 || (!filesfrom_host && protocol_version >= 23))
io_start_multiplex_in(f_in);
+ else
+ io_start_buffering_in(f_in);
send_filter_list(f_out);
if (filesfrom_host)
filesfrom_fd = f_in;
io_start_multiplex_in(f_in);
if (need_messages_from_generator)
io_start_multiplex_out(f_out);
+ else
+ io_start_buffering_out(f_out);
}
send_filter_list(read_batch ? -1 : f_out);
if (DEBUG_GTE(CMD, 2)) {
rprintf(FINFO,"cmd=%s machine=%s user=%s path=%s\n",
NS(shell_cmd), NS(shell_machine), NS(shell_user),
- remote_argv ? NS(remote_argv[0]) : "");
+ NS(remote_argv[0]));
}
pid = do_cmd(shell_cmd, shell_machine, shell_user, remote_argv, remote_argc,