Browse Source

* add cleanup() routine

master
Alex 'AdUser' Z 8 years ago
parent
commit
dd12854d02
  1. 10
      src/client.c

10
src/client.c

@ -77,12 +77,18 @@ handle_cmd(const char *line) {
return EXIT_SUCCESS;
}
void cleanup() {
f2b_csocket_disconnect(opts.csocket, opts.csocket_cpath);
unlink(opts.csocket_cpath);
}
void
signal_handler(int signum) {
switch (signum) {
case SIGINT:
case SIGTERM:
unlink(opts.csocket_cpath);
cleanup();
exit(EXIT_SUCCESS);
break;
default:
break;
@ -176,7 +182,7 @@ int main(int argc, char *argv[]) {
line = NULL;
}
f2b_csocket_disconnect(opts.csocket, opts.csocket_cpath);
cleanup();
return EXIT_SUCCESS;
}

Loading…
Cancel
Save