summaryrefslogtreecommitdiff
path: root/src/basic/log.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-02-26 15:41:38 +0100
committerSven Eden <yamakuzure@gmx.net>2018-05-30 07:59:08 +0200
commitecc6cb9a01b132b88cdf20272573c142eeb84e8b (patch)
tree06761bc1094a87d041a9376307d5555550557ce1 /src/basic/log.c
parent89e3fcd3115e66914561b804009a3b60c574d3c9 (diff)
util: add new safe_close_above_stdio() wrapper
At various places we only want to close fds if they are not stdin/stdout/stderr, i.e. fds 0, 1, 2. Let's add a unified helper call for that, and port everything over.
Diffstat (limited to 'src/basic/log.c')
-rw-r--r--src/basic/log.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/basic/log.c b/src/basic/log.c
index 719702054..84c92d1c7 100644
--- a/src/basic/log.c
+++ b/src/basic/log.c
@@ -96,14 +96,7 @@ static char *log_abort_msg = NULL;
} while (false)
static void log_close_console(void) {
-
- if (console_fd < 0)
- return;
-
- if (console_fd >= 3)
- safe_close(console_fd);
-
- console_fd = -1;
+ console_fd = safe_close_above_stdio(console_fd);
}
static int log_open_console(void) {