Blame SOURCES/rsync-3.1.0-sigterm-handle.patch
|
|
4666ac |
diff --git a/rsync.c b/rsync.c
|
|
|
4666ac |
index 104b274..b50146c 100644
|
|
|
4666ac |
--- a/rsync.c
|
|
|
4666ac |
+++ b/rsync.c
|
|
|
4666ac |
@@ -37,6 +37,7 @@ extern int preserve_times;
|
|
|
4666ac |
extern int copy_devices;
|
|
|
4666ac |
extern int am_root;
|
|
|
4666ac |
extern int am_server;
|
|
|
4666ac |
+extern int am_daemon;
|
|
|
4666ac |
extern int am_sender;
|
|
|
4666ac |
extern int am_receiver;
|
|
|
4666ac |
extern int am_generator;
|
|
|
4666ac |
@@ -537,7 +538,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
|
|
|
4666ac |
return updated;
|
|
|
4666ac |
}
|
|
|
4666ac |
|
|
|
4666ac |
-RETSIGTYPE sig_int(UNUSED(int val))
|
|
|
4666ac |
+RETSIGTYPE sig_int(int sig_num)
|
|
|
4666ac |
{
|
|
|
4666ac |
/* KLUGE: if the user hits Ctrl-C while ssh is prompting
|
|
|
4666ac |
* for a password, then our cleanup's sending of a SIGUSR1
|
|
|
4666ac |
@@ -548,6 +549,11 @@ RETSIGTYPE sig_int(UNUSED(int val))
|
|
|
4666ac |
* not ssh waiting for a password, then this tiny delay
|
|
|
4666ac |
* shouldn't hurt anything. */
|
|
|
4666ac |
msleep(400);
|
|
|
4666ac |
+
|
|
|
4666ac |
+ /* If we're an rsync daemon listener (not a daemon server),
|
|
|
4666ac |
+ * we'll exit with status 0 if we received SIGTERM. */
|
|
|
4666ac |
+ if (am_daemon && !am_server && sig_num == SIGTERM)
|
|
|
4666ac |
+ exit_cleanup(0);
|
|
|
4666ac |
exit_cleanup(RERR_SIGNAL);
|
|
|
4666ac |
}
|
|
|
4666ac |
|