diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-06-14 16:50:35 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-06-15 22:51:01 +0200 |
commit | fd1f9c89f72ebbe5d071cccf7754299fc87b9b26 (patch) | |
tree | ad566a9b97c30bb15fc85413e626ca06bdd79479 | |
parent | 77d4acf332abd24025f31455f492fa83d97cb2e1 (diff) |
execute: minor coding style improvements
-rw-r--r-- | src/core/execute.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/core/execute.c b/src/core/execute.c index c20650626c..b5a5997f15 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -289,7 +289,15 @@ static int connect_journal_socket(int fd, uid_t uid, gid_t gid) { return r; } -static int connect_logger_as(const ExecContext *context, ExecOutput output, const char *ident, const char *unit_id, int nfd, uid_t uid, gid_t gid) { +static int connect_logger_as( + const ExecContext *context, + ExecOutput output, + const char *ident, + const char *unit_id, + int nfd, + uid_t uid, + gid_t gid) { + int fd, r; assert(context); @@ -310,7 +318,7 @@ static int connect_logger_as(const ExecContext *context, ExecOutput output, cons return -errno; } - fd_inc_sndbuf(fd, SNDBUF_SIZE); + (void) fd_inc_sndbuf(fd, SNDBUF_SIZE); dprintf(fd, "%s\n" @@ -328,11 +336,11 @@ static int connect_logger_as(const ExecContext *context, ExecOutput output, cons output == EXEC_OUTPUT_KMSG || output == EXEC_OUTPUT_KMSG_AND_CONSOLE, is_terminal_output(output)); - if (fd != nfd) { - r = dup2(fd, nfd) < 0 ? -errno : nfd; - safe_close(fd); - } else - r = nfd; + if (fd == nfd) + return nfd; + + r = dup2(fd, nfd) < 0 ? -errno : nfd; + safe_close(fd); return r; } |