diff options
author | David Herrmann <dh.herrmann@googlemail.com> | 2011-12-02 15:10:07 +0100 |
---|---|---|
committer | David Herrmann <dh.herrmann@googlemail.com> | 2011-12-02 15:10:07 +0100 |
commit | 9093189f2f1b10239e0c30b812edd85ee807621f (patch) | |
tree | de7623feb63809ceb5282579eff99ee84e046a31 /tests/test_output.c | |
parent | 41c56410ee389f8b2d330d89b5439d1d3366a7d8 (diff) |
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 <dh.herrmann@googlemail.com>
Diffstat (limited to 'tests/test_output.c')
-rw-r--r-- | tests/test_output.c | 12 |
1 files changed, 12 insertions, 0 deletions
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 <inttypes.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <unistd.h> #include <GL/gl.h> #include <GL/glext.h> #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); |