diff options
Diffstat (limited to '')
-rw-r--r-- | src/satd-rm.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/satd-rm.c b/src/satd-rm.c index 6a9f6cd..58b9eed 100644 --- a/src/satd-rm.c +++ b/src/satd-rm.c @@ -39,6 +39,8 @@ main(int argc, char *argv[]) size_t n = 0; char *message = NULL; char **msg_argv = NULL; + char **arg; + int rc = 0; /* Receive and validate message. */ t (readall(SOCK_FILENO, &message, &n) || !n || message[n - 1]); @@ -46,7 +48,21 @@ main(int argc, char *argv[]) msg_argv = restore_array(message, n, NULL); t (!msg_argv); - return 0; + /* Perform action. */ + for (arg = msg_argv; *arg; arg++) + t (remove_job(*arg, 0) && errno); + +done: + /* Cleanup. */ + shutdown(SOCK_FILENO, SHUT_WR); + close(SOCK_FILENO); + free(msg_argv); + free(message); + return rc; fail: + if (send_string(SOCK_FILENO, STDERR_FILENO, argv[0], ": ", strerror(errno), "\n", NULL)) + perror(argv[0]); + rc = 1; + goto done; } |