From: David Herrmann Date: Fri, 2 Dec 2011 14:10:07 +0000 (+0100) Subject: test_output: Catch SIGINT and SIGTERM X-Git-Tag: kmscon-7~1339 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9093189f2f1b10239e0c30b812edd85ee807621f;p=platform%2Fupstream%2Fkmscon.git 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 --- 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);