aboutsummaryrefslogtreecommitdiffstats
path: root/src/satd-rm.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@member.fsf.org>2015-12-29 06:04:22 +0100
committerMattias Andrée <maandree@member.fsf.org>2015-12-29 06:04:22 +0100
commit0463a2113c552cfd443b69bcfe23a62f159d5bf2 (patch)
treef9ad680c40dea40c9de83a6ca306171f53b25332 /src/satd-rm.c
parentwhitespace (diff)
downloadsat-0463a2113c552cfd443b69bcfe23a62f159d5bf2.tar.gz
sat-0463a2113c552cfd443b69bcfe23a62f159d5bf2.tar.bz2
sat-0463a2113c552cfd443b69bcfe23a62f159d5bf2.tar.xz
a bit cleaner
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to 'src/satd-rm.c')
-rw-r--r--src/satd-rm.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/satd-rm.c b/src/satd-rm.c
index f245a1f..6fe0aac 100644
--- a/src/satd-rm.c
+++ b/src/satd-rm.c
@@ -39,10 +39,7 @@ main(int argc, char *argv[])
char *message = NULL;
char **msg_argv = NULL;
char **arg;
- int rc = 0;
-
- assert(argc == 3);
- t (reopen(STATE_FILENO, O_RDWR));
+ DAEMON_PROLOGUE;
/* Receive and validate message. */
t (readall(SOCK_FILENO, &message, &n) || !n || message[n - 1]);
@@ -54,20 +51,9 @@ main(int argc, char *argv[])
for (arg = msg_argv; *arg; arg++)
t (remove_job(*arg, 0) && errno);
-done:
- /* Cleanup. */
- shutdown(SOCK_FILENO, SHUT_WR);
- close(SOCK_FILENO);
- close(STATE_FILENO);
+ DAEMON_CLEANUP_START;
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;
-
- (void) argc;
+ DAEMON_CLEANUP_END;
}