From feb1229dc3372720fa0cf5fc5aa1ee754eeb43a0 Mon Sep 17 00:00:00 2001 From: ligd Date: Thu, 23 Aug 2018 07:05:09 -0600 Subject: [PATCH] apps/system/cu/cu_main.c: (1) Protect from possible re-definition of signal values, (2) Fix CU ctrl-C hand when remote core hang. --- system/cu/cu_main.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/system/cu/cu_main.c b/system/cu/cu_main.c index 8031a86bd..8c8a02721 100644 --- a/system/cu/cu_main.c +++ b/system/cu/cu_main.c @@ -61,9 +61,17 @@ * Pre-processor Definitions ****************************************************************************/ -#define SIGINT 2 -#define SIGKILL 9 -#define SIGTERM 15 +#ifndef SIGINT +# define SIGINT 2 +#endif + +#ifndef SIGKILL +# define SIGKILL 9 +#endif + +#ifndef SIGTERM +# define SIGTERM 15 +#endif enum parity_mode { @@ -119,6 +127,7 @@ static FAR void *cu_listener(FAR void *parameter) static void sigint(int sig) { pthread_cancel(g_cu.listener); + tcflush(g_cu.outfd, TCIOFLUSH); close(g_cu.outfd); close(g_cu.infd); exit(0);