dvbv5-zap: exit nicely on SIGTERM/SIGINT
authorMauro Carvalho Chehab <m.chehab@samsung.com>
Wed, 27 Nov 2013 16:20:46 +0000 (14:20 -0200)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Wed, 27 Nov 2013 16:20:46 +0000 (14:20 -0200)
If the program is killed or aborted with CTRL-C, dies nicely.

That warrants that any data being processed to be handled, that
opened files will be closed and that the memory gets freed.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
utils/dvb/dvbv5-zap.c

index a2b8205..7ab553e 100644 (file)
@@ -747,6 +747,8 @@ int main(int argc, char **argv)
 
        if (args.traffic_monitor) {
                signal(SIGALRM, do_timeout);
+               signal(SIGTERM, do_timeout);
+               signal(SIGINT, do_timeout);
                if (args.timeout > 0)
                        alarm(args.timeout);
 
@@ -825,6 +827,8 @@ int main(int argc, char **argv)
        }
 
        signal(SIGALRM, do_timeout);
+       signal(SIGTERM, do_timeout);
+       signal(SIGINT, do_timeout);
        if (args.timeout > 0)
                alarm(args.timeout);