Do a small msleep() in the sig_int() handler before shutting down.
authorWayne Davison <wayned@samba.org>
Fri, 19 Dec 2003 06:52:02 +0000 (06:52 +0000)
committerWayne Davison <wayned@samba.org>
Fri, 19 Dec 2003 06:52:02 +0000 (06:52 +0000)
This kluge allows things like SIGINT to find our children before
we go throwing around SIGUSR1's at them.

rsync.c

diff --git a/rsync.c b/rsync.c
index cfee2d036852e8d48ff0288087a414501ca168f9..6c8143c3f681cfb8ec658829cb60c4a716e277b6 100644 (file)
--- a/rsync.c
+++ b/rsync.c
@@ -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);
 }