From 9093189f2f1b10239e0c30b812edd85ee807621f Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Fri, 2 Dec 2011 15:10:07 +0100 Subject: [PATCH] test_output: Catch SIGINT and SIGTERM Correctly handle SIGINT and SIGTERM. This will also reset the crtc so it won't stay black if the application is killed. Signed-off-by: David Herrmann --- tests/test_output.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_output.c b/tests/test_output.c index 7653f55..92b836e 100644 --- a/tests/test_output.c +++ b/tests/test_output.c @@ -46,14 +46,20 @@ #define GL_GLEXT_PROTOTYPES #include +#include #include #include +#include #include #include #include #include "output.h" +static void sig_term(int sig) +{ +} + static int set_outputs(struct kmscon_compositor *comp, int num, char **list) { struct kmscon_output *iter; @@ -159,6 +165,12 @@ int main(int argc, char **argv) { struct kmscon_compositor *comp; int ret; + struct sigaction sig; + + memset(&sig, 0, sizeof(sig)); + sig.sa_handler = sig_term; + sigaction(SIGTERM, &sig, NULL); + sigaction(SIGINT, &sig, NULL); printf("Creating compositor...\n"); ret = kmscon_compositor_new(&comp); -- 2.7.4