X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/1bbd10fe070d8b07a8c4991e17d1fc04295fe42e..6aaf8d8c1041b524d985bf09b9a3f5e371cf8ac2:/util.c diff --git a/util.c b/util.c index 8ba34744..245f3b29 100644 --- a/util.c +++ b/util.c @@ -84,7 +84,7 @@ int fd_pair(int fd[2]) } -void print_child_argv(char **cmd) +static void print_child_argv(char **cmd) { rprintf(FINFO, "opening connection using "); for (; *cmd; cmd++) { @@ -240,10 +240,18 @@ void overflow(char *str) -int set_modtime(char *fname,time_t modtime) +int set_modtime(char *fname, time_t modtime) { extern int dry_run; - if (dry_run) return 0; + if (dry_run) + return 0; + + if (verbose > 2) { + rprintf(FINFO, "set modtime of %s to (%ld) %s", + fname, (long) modtime, + asctime(localtime(&modtime))); + } + { #ifdef HAVE_UTIMBUF struct utimbuf tbuf; @@ -470,27 +478,47 @@ int robust_rename(char *from, char *to) static pid_t all_pids[10]; static int num_pids; -/* fork and record the pid of the child */ +/** Fork and record the pid of the child. **/ pid_t do_fork(void) { pid_t newpid = fork(); - if (newpid) { + if (newpid != 0 && newpid != -1) { all_pids[num_pids++] = newpid; } return newpid; } -/* kill all children */ +/** + * Kill all children. + * + * @todo It would be kind of nice to make sure that they are actually + * all our children before we kill them, because their pids may have + * been recycled by some other process. Perhaps when we wait for a + * child, we should remove it from this array. Alternatively we could + * perhaps use process groups, but I think that would not work on + * ancient Unix versions that don't support them. + **/ void kill_all(int sig) { int i; - for (i=0;i 1024*1024) {