X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/7a2fd68b966a404a50de922053d6f0dd17151bee..d5a0b483797359517de787c33f518a4c804041f4:/rsync.c diff --git a/rsync.c b/rsync.c index 36d7b8b1..6c8143c3 100644 --- a/rsync.c +++ b/rsync.c @@ -133,7 +133,7 @@ static int is_in_group(gid_t gid) /* treat failure (-1) as if not member of any group */ ngroups = getgroups(0, 0); if (ngroups > 0) { - gidset = (GETGROUPS_T *) malloc(ngroups * sizeof(GETGROUPS_T)); + gidset = new_array(GETGROUPS_T, ngroups); ngroups = getgroups(ngroups, gidset); } } @@ -237,6 +237,15 @@ int set_perms(char *fname,struct file_struct *file,STRUCT_STAT *st, void sig_int(void) { + /* KLUGE: if the user hits Ctrl-C while ssh is prompting + * for a password, then our cleanup's sending of a SIGUSR1 + * signal to all our children may kill ssh before it has a + * chance to restore the tty settings (i.e. turn echo back + * on). By sleeping for a short time, ssh gets a bigger + * chance to do the right thing. If child processes are + * not ssh waiting for a password, then this tiny delay + * shouldn't hurt anything. */ + msleep(400); exit_cleanup(RERR_SIGNAL); }