From 0463a2113c552cfd443b69bcfe23a62f159d5bf2 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 29 Dec 2015 06:04:22 +0100 Subject: a bit cleaner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/satd-run.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'src/satd-run.c') diff --git a/src/satd-run.c b/src/satd-run.c index 1b92558..6e4eef1 100644 --- a/src/satd-run.c +++ b/src/satd-run.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])); @@ -62,20 +59,9 @@ main(int argc, char *argv[]) t (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; } -- cgit v1.2.3-70-g09d2