New logging categories added to allow differentiation between
[rsync/rsync.git] / main.c
diff --git a/main.c b/main.c
index 4b67f2a..4c040b9 100644 (file)
--- a/main.c
+++ b/main.c
@@ -41,7 +41,7 @@ extern int remove_source_files;
 extern int need_messages_from_generator;
 extern int kluge_around_eof;
 extern int do_stats;
-extern int log_got_error;
+extern int got_xfer_error;
 extern int module_id;
 extern int copy_links;
 extern int copy_dirlinks;
@@ -272,9 +272,10 @@ static void output_summary(void)
                        "sent %s bytes  received %s bytes  %s bytes/sec\n",
                        human_num(total_written), human_num(total_read),
                        human_dnum((total_written + total_read)/(0.5 + (endtime - starttime)), 2));
-               rprintf(FINFO, "total size is %s  speedup is %.2f\n",
+               rprintf(FINFO, "total size is %s  speedup is %.2f%s\n",
                        human_num(stats.total_size),
-                       (double)stats.total_size / (total_written+total_read));
+                       (double)stats.total_size / (total_written+total_read),
+                       dry_run ? " (DRY RUN)" : "");
        }
 
        fflush(stdout);
@@ -440,6 +441,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);
@@ -448,13 +450,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
@@ -712,7 +724,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] = ".";
@@ -914,10 +926,10 @@ static void do_server_recv(int f_in, int f_out, int argc, char *argv[])
        if (sanitize_paths) {
                char **dir;
                for (dir = basis_dir; *dir; dir++) {
-                       *dir = sanitize_path(NULL, *dir, NULL, curr_dir_depth, NULL);
+                       *dir = sanitize_path(NULL, *dir, NULL, curr_dir_depth);
                }
                if (partial_dir) {
-                       partial_dir = sanitize_path(NULL, partial_dir, NULL, curr_dir_depth, NULL);
+                       partial_dir = sanitize_path(NULL, partial_dir, NULL, curr_dir_depth);
                }
        }
        fix_basis_dirs();
@@ -1298,7 +1310,7 @@ static RETSIGTYPE sigusr2_handler(UNUSED(int val))
        if (!am_server)
                output_summary();
        close_all();
-       if (log_got_error)
+       if (got_xfer_error)
                _exit(RERR_PARTIAL);
        _exit(0);
 }
@@ -1476,7 +1488,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) {