Commit 4d1705e3 authored by Cedric Roux's avatar Cedric Roux
Browse files

T: minor: close socket

Sometimes when the user does ctrl+c to quit, it may not quit
if nothing comes on the socket. Closing the socket in the
signal handler fixes this.
parent faae3c8c
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <stdint.h> #include <stdint.h>
#include <inttypes.h> #include <inttypes.h>
#include <signal.h> #include <signal.h>
#include <unistd.h>
#include "database.h" #include "database.h"
#include "utils.h" #include "utils.h"
#include "handler.h" #include "handler.h"
...@@ -181,10 +182,13 @@ void usage(void) ...@@ -181,10 +182,13 @@ void usage(void)
} }
int run = 1; int run = 1;
static int socket = -1;
void force_stop(int x) void force_stop(int x)
{ {
printf("\ngently quit...\n"); printf("\ngently quit...\n");
close(socket);
socket = -1;
run = 0; run = 0;
} }
...@@ -198,7 +202,6 @@ int main(int n, char **v) ...@@ -198,7 +202,6 @@ int main(int n, char **v)
int *is_on; int *is_on;
int number_of_events; int number_of_events;
int i; int i;
int socket;
vcd_vars vars[n]; vcd_vars vars[n];
int nvars = 0; int nvars = 0;
view *vcd_view; view *vcd_view;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment