summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Ramsay <jim_ramsay@dell.com>2011-07-20 09:06:44 -0400
committerMike Christie <michaelc@cs.wisc.edu>2011-08-02 00:04:14 -0500
commitf69f9d781a537d4cce1e7c90779feabb052f87e5 (patch)
treec3df88a56b8823f60d6e69cad774d25538393aed
parent51cab9ce2163eb8d798b1511b7df9141af8ff17c (diff)
downloadopen-iscsi-f69f9d781a537d4cce1e7c90779feabb052f87e5.tar.gz
iscsid: In foreground mode, treat SIGINT like SIGTERM
This allows ^C to exit iscsid but only when it is running in foreground mode, which is useful for testing. Signed-off-by: Jim Ramsay <jim_ramsay@dell.com>
-rw-r--r--usr/iscsid.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/usr/iscsid.c b/usr/iscsid.c
index 1a37347..9df6658 100644
--- a/usr/iscsid.c
+++ b/usr/iscsid.c
@@ -304,6 +304,11 @@ static void iscsid_shutdown(void)
static void catch_signal(int signo)
{
log_debug(1, "pid %d caught signal %d", getpid(), signo);
+
+ /* In foreground mode, treat SIGINT like SIGTERM */
+ if (!daemonize && signo == SIGINT)
+ signo = SIGTERM;
+
switch (signo) {
case SIGTERM:
iscsid_shutdown();