X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/a960239f392402581eea6aaeaa49da96e46247bf..0379c8eca1716810c06a0c8710c06d77a6256be6:/main.c diff --git a/main.c b/main.c index 80224ca1..92b5c44b 100644 --- a/main.c +++ b/main.c @@ -50,6 +50,7 @@ extern int preserve_hard_links; extern int protocol_version; extern int file_total; extern int recurse; +extern int xfer_dirs; extern int protect_args; extern int relative_paths; extern int sanitize_paths; @@ -439,6 +440,7 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in if (read_batch) { int from_gen_pipe[2]; + set_allow_inc_recurse(); if (fd_pair(from_gen_pipe) < 0) { rsyserr(FERROR, errno, "pipe"); exit_cleanup(RERR_IPC); @@ -447,13 +449,23 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in *f_out_p = from_gen_pipe[1]; *f_in_p = batch_fd; ret = -1; /* no child pid */ +#ifdef ICONV_CONST + setup_iconv(); +#endif } else if (local_server) { /* If the user didn't request --[no-]whole-file, force * it on, but only if we're not batch processing. */ if (whole_file < 0 && !write_batch) whole_file = 1; + set_allow_inc_recurse(); ret = local_child(argc, args, f_in_p, f_out_p, child_main); +#ifdef ICONV_CONST + setup_iconv(); +#endif } else { +#ifdef ICONV_CONST + setup_iconv(); +#endif if (protect_args) { int fd; #ifdef ICONV_OPTION @@ -711,7 +723,7 @@ static void do_server_sender(int f_in, int f_out, int argc, char *argv[]) argc--; argv++; - if (argc == 0 && (recurse || list_only)) { + if (argc == 0 && (recurse || xfer_dirs || list_only)) { argc = 1; argv--; argv[0] = "."; @@ -1048,8 +1060,10 @@ int client_run(int f_in, int f_out, pid_t pid, int argc, char *argv[]) io_start_multiplex_out(); } - if (argc == 0) + if (argc == 0) { list_only |= 1; + xfer_dirs |= 1; + } send_filter_list(read_batch ? -1 : f_out); @@ -1161,7 +1175,8 @@ static int start_client(int argc, char *argv[]) static char *dotarg[1] = { "." }; p = dotarg[0]; remote_argv = dotarg; - list_only = 1; + list_only |= 1; + xfer_dirs |= 1; } remote_argc = 1; @@ -1233,8 +1248,10 @@ static int start_client(int argc, char *argv[]) } remote_argv[i] = arg; } - if (argc == 0) + if (argc == 0) { list_only |= 1; + xfer_dirs |= 1; + } } if (daemon_over_rsh < 0) @@ -1470,7 +1487,11 @@ int main(int argc,char *argv[]) if (write_batch < 0) dry_run = 1; - if (am_daemon && !am_server) + if (am_server) { +#ifdef ICONV_CONST + setup_iconv(); +#endif + } else if (am_daemon) return daemon_main(); if (am_server && protect_args) {