From d524211c2acc97f1b4d89bfbff646227f641f28a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yannic=20Schr=C3=B6der?= Date: Tue, 20 Sep 2016 14:18:21 +0200 Subject: [PATCH] Clean exit of serialdump when hitting Ctrl-C Ctrl-C is the best way to close serialdump after using make login. With a clean exit it will signal to make that the make run was successful. --- tools/sky/serialdump.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/sky/serialdump.c b/tools/sky/serialdump.c index 7cc0d0e1e..1fc93ef49 100644 --- a/tools/sky/serialdump.c +++ b/tools/sky/serialdump.c @@ -8,6 +8,7 @@ #include #include #include +#include #define BAUDRATE B115200 #define BAUDRATE_S "115200" @@ -82,9 +83,17 @@ print_hex_line(char *prefix, unsigned char *outbuf, int index) } } +static void +intHandler(int sig) +{ + exit(0); +} + int main(int argc, char **argv) { + signal(SIGINT, intHandler); + struct termios options; fd_set mask, smask; int fd;