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.
This commit is contained in:
+1
-8
@@ -94,14 +94,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) {
|
||||
|
||||
Reference in New Issue
Block a user