tree-wide: set FORK_RLIMIT_NOFILE_SAFE flag

No functional changes, just refactoring.
This commit is contained in:
Yu Watanabe
2023-02-07 14:39:49 +09:00
parent e955a7f460
commit f3f2d02e97
7 changed files with 8 additions and 29 deletions
+1 -3
View File
@@ -85,7 +85,7 @@ static int spawn_child(const char* child, char** argv) {
if (pipe(fd) < 0)
return log_error_errno(errno, "Failed to create pager pipe: %m");
r = safe_fork("(remote)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG, &child_pid);
r = safe_fork("(remote)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG|FORK_RLIMIT_NOFILE_SAFE, &child_pid);
if (r < 0) {
safe_close_pair(fd);
return r;
@@ -101,8 +101,6 @@ static int spawn_child(const char* child, char** argv) {
_exit(EXIT_FAILURE);
}
(void) rlimit_nofile_safe();
execvp(child, argv);
log_error_errno(errno, "Failed to exec child %s: %m", child);
_exit(EXIT_FAILURE);