diff mbox

[v4l-utils,PATCH-v2,2/4] dvbv5-zap.c: allow timeout with -x

Message ID 1450448906-17000-3-git-send-email-jdenson@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jemma Denson Dec. 18, 2015, 2:28 p.m. UTC
Timeout handlers aren't set when running with -x (exit after tuning).
This patch adds handlers so -t can be used with -x.

Without a timeout dvbv5-zap will run forever if there's no signal,
preventing it's use by scripts to obtain signal stats.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
---
 utils/dvb/dvbv5-zap.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox

Patch

diff --git a/utils/dvb/dvbv5-zap.c b/utils/dvb/dvbv5-zap.c
index e927383..2d19d45 100644
--- a/utils/dvb/dvbv5-zap.c
+++ b/utils/dvb/dvbv5-zap.c
@@ -855,6 +855,13 @@  int main(int argc, char **argv)
 		goto err;
 
 	if (args.exit_after_tuning) {
+		signal(SIGTERM, do_timeout);
+		signal(SIGINT, do_timeout);
+		if (args.timeout > 0) {
+			signal(SIGALRM, do_timeout);
+			alarm(args.timeout);
+		}
+
 		err = 0;
 		check_frontend(&args, parms);
 		goto err;