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:
@@ -1428,8 +1428,7 @@ int fork_agent(const char *name, const int except[], unsigned n_except, pid_t *r
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (fd > STDERR_FILENO)
|
||||
close(fd);
|
||||
safe_close_above_stdio(fd);
|
||||
}
|
||||
|
||||
/* Count arguments */
|
||||
|
||||
Reference in New Issue
Block a user