summaryrefslogtreecommitdiff
path: root/netsniff-ng.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2014-02-21 18:44:25 +0100
committerTobias Klauser <tklauser@distanz.ch>2014-02-21 18:48:42 +0100
commit064f4eddf1facae6eb50a7d928c6b049ee4231bf (patch)
treec7c6a813b231043c84e9a9d42db9b85ebadf4489 /netsniff-ng.c
parent1c2d641fc0a17d98b65709309e113e29d8834d9c (diff)
netsniff-ng: Exit gracefully for all possible termination signals
Handle all termination signals that we're allowed to handle (SIGKILL can't be handled) in order to exit gracefully in any regular termination case. Without this fix, pcap files written by netsniff-ng might be corrupted. Reported-by: Mike Westmacott <mikewestmacott@googlemail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'netsniff-ng.c')
-rw-r--r--netsniff-ng.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/netsniff-ng.c b/netsniff-ng.c
index c5966b1..351dcc9 100644
--- a/netsniff-ng.c
+++ b/netsniff-ng.c
@@ -113,6 +113,8 @@ static void signal_handler(int number)
{
switch (number) {
case SIGINT:
+ case SIGQUIT:
+ case SIGTERM:
sigint = 1;
case SIGHUP:
default:
@@ -1372,6 +1374,8 @@ int main(int argc, char **argv)
ctx.device_in = xstrdup("any");
register_signal(SIGINT, signal_handler);
+ register_signal(SIGQUIT, signal_handler);
+ register_signal(SIGTERM, signal_handler);
register_signal(SIGHUP, signal_handler);
tprintf_init();