From: Julien Desfossez Date: Fri, 27 May 2011 20:41:41 +0000 (+0200) Subject: Ignore first SIGINT X-Git-Tag: v2.0-pre1~102 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=13e4474551ccec777c78fab783105093fd47c42d;p=lttng-tools.git Ignore first SIGINT Add a counter to ignore the first ctrl+c (especially useful when sessiond spawn kconsumerd). If the user presses ctrl+c an other time, kconsumerd dies as expected. Signed-off-by: Julien Desfossez --- diff --git a/kconsumerd/kconsumerd.c b/kconsumerd/kconsumerd.c index 8e8f1a618..adc1f1bed 100644 --- a/kconsumerd/kconsumerd.c +++ b/kconsumerd/kconsumerd.c @@ -67,6 +67,9 @@ static int poll_pipe[2]; /* socket to communicate errors with sessiond */ static int error_socket = -1; +/* to count the number of time the user pressed ctrl+c */ +static int sigintcount = 0; + /* Argument variables */ int opt_quiet; int opt_verbose; @@ -185,6 +188,11 @@ end: */ static void sighandler(int sig) { + if (sig == SIGINT && sigintcount++ == 0) { + DBG("ignoring first SIGINT"); + return; + } + cleanup(); return;