Use buffered I/O to read the exclude list.
[rsync/rsync.git] / rsync.c
diff --git a/rsync.c b/rsync.c
index 36d7b8b..6c8143c 100644 (file)
--- 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);
 }