Add SIGTERM signal handler to also call cleanup
authorJack Peel <jack.peel@synapse.com>
Sat, 6 Apr 2013 00:55:19 +0000 (17:55 -0700)
committerJack Peel <jack.peel@synapse.com>
Sat, 6 Apr 2013 00:55:19 +0000 (17:55 -0700)
When stopping st-util under Eclipse as an external tool the st-util
receives a SIGTERM signal, and would not return the device to
usb mass storage mode.  This change now calls cleanup in the SIGTERM handler too!!

gdbserver/gdb-server.c

index ad7ce6570465237efc84873e03dd6da473af6dc5..f9c06f9831b17fee476e36b12e42472ad63ce4fe 100644 (file)
@@ -67,6 +67,8 @@ static void cleanup(int signal __attribute__((unused))) {
     exit(1);
 }
 
+
+
 int parse_options(int argc, char** argv, st_state_t *st) {
     static struct option long_options[] = {
         {"help", no_argument, NULL, 'h'},
@@ -186,6 +188,7 @@ int main(int argc, char** argv) {
 
     connected_stlink = sl;
     signal(SIGINT, &cleanup);
+    signal(SIGTERM, &cleanup);
 
        printf("Chip ID is %08x, Core ID is  %08x.\n", sl->chip_id, sl->core_id);