| diff --git a/tools/evemu-record.c b/tools/evemu-record.c |
| index afdd400..f75c0bb 100644 |
| --- a/tools/evemu-record.c |
| +++ b/tools/evemu-record.c |
| @@ -42,15 +42,26 @@ |
| |
| #include "evemu.h" |
| #include <stdio.h> |
| +#include <stdlib.h> |
| #include <fcntl.h> |
| #include <string.h> |
| #include <unistd.h> |
| +#include <signal.h> |
| |
| #define WAIT_MS 10000 |
| |
| +int fd; |
| + |
| +void close_file() |
| +{ |
| + close(fd); |
| + exit(1); |
| +} |
| + |
| int main(int argc, char *argv[]) |
| { |
| - int fd; |
| + signal(SIGINT, close_file); |
| + signal(SIGTERM, close_file); |
| if (argc < 2) { |
| fprintf(stderr, "Usage: %s <device>\n", argv[0]); |
| return -1; |