Man page: Move the description of --info=progress2 to a better place.
[rsync/rsync.git] / util.c
diff --git a/util.c b/util.c
index 3f611d1..abf0cd4 100644 (file)
--- a/util.c
+++ b/util.c
@@ -94,6 +94,7 @@ int fd_pair(int fd[2])
 
 void print_child_argv(const char *prefix, char **cmd)
 {
+       int cnt = 0;
        rprintf(FCLIENT, "%s ", prefix);
        for (; *cmd; cmd++) {
                /* Look for characters that ought to be quoted.  This
@@ -107,8 +108,9 @@ void print_child_argv(const char *prefix, char **cmd)
                } else {
                        rprintf(FCLIENT, "%s ", *cmd);
                }
+               cnt++;
        }
-       rprintf(FCLIENT, "\n");
+       rprintf(FCLIENT, " (%d args)\n", cnt);
 }
 
 NORETURN void out_of_memory(const char *str)
@@ -1062,8 +1064,9 @@ int change_dir(const char *dir, int set_path_only)
                        errno = ENAMETOOLONG;
                        return 0;
                }
-               curr_dir[curr_dir_len] = '/';
-               memcpy(curr_dir + curr_dir_len + 1, dir, len + 1);
+               if (!(curr_dir_len && curr_dir[curr_dir_len-1] == '/'))
+                       curr_dir[curr_dir_len++] = '/';
+               memcpy(curr_dir + curr_dir_len, dir, len + 1);
 
                if (!set_path_only && chdir(curr_dir)) {
                        curr_dir[curr_dir_len] = '\0';