No functional changes, just refactoring.
#include "path-util.h"
#include "proc-cmdline.h"
#include "process-util.h"
-#include "rlimit-util.h"
#include "signal-util.h"
#include "socket-util.h"
#include "special.h"
pipe(progress_pipe) < 0)
return log_error_errno(errno, "pipe(): %m");
- r = safe_fork("(fsck)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG, &pid);
+ r = safe_fork("(fsck)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG|FORK_RLIMIT_NOFILE_SAFE, &pid);
if (r < 0)
return r;
if (r == 0) {
cmdline[i++] = device;
cmdline[i++] = NULL;
- (void) rlimit_nofile_safe();
-
execv(cmdline[0], (char**) cmdline);
_exit(FSCK_OPERATIONAL_ERROR);
}
#include "process-util.h"
#include "pull-common.h"
#include "pull-job.h"
-#include "rlimit-util.h"
#include "rm-rf.h"
#include "signal-util.h"
#include "siphash24.h"
gpg_home_created = true;
- r = safe_fork("(gpg)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG, &pid);
+ r = safe_fork("(gpg)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG|FORK_RLIMIT_NOFILE_SAFE, &pid);
if (r < 0)
return r;
if (r == 0) {
_exit(EXIT_FAILURE);
}
- (void) rlimit_nofile_safe();
-
cmd[k++] = strjoina("--homedir=", gpg_home);
/* We add the user keyring only to the command line arguments, if it's around since gpg fails
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;
_exit(EXIT_FAILURE);
}
- (void) rlimit_nofile_safe();
-
execvp(child, argv);
log_error_errno(errno, "Failed to exec child %s: %m", child);
_exit(EXIT_FAILURE);
#include "memory-util.h"
#include "path-util.h"
#include "process-util.h"
-#include "rlimit-util.h"
#include "signal-util.h"
#include "stdio-util.h"
#include "string-util.h"
if (r < 0)
return -errno;
- r = safe_fork_full("(sd-busexec)", s+1, 1, FORK_RESET_SIGNALS|FORK_CLOSE_ALL_FDS, &b->busexec_pid);
+ r = safe_fork_full("(sd-busexec)", s+1, 1, FORK_RESET_SIGNALS|FORK_CLOSE_ALL_FDS|FORK_RLIMIT_NOFILE_SAFE, &b->busexec_pid);
if (r < 0) {
safe_close_pair(s);
return r;
if (r < 0)
_exit(EXIT_FAILURE);
- (void) rlimit_nofile_safe();
-
if (b->exec_argv)
execvp(b->exec_path, b->exec_argv);
else
#include "mkdir.h"
#include "nspawn-setuid.h"
#include "process-util.h"
-#include "rlimit-util.h"
#include "signal-util.h"
#include "string-util.h"
#include "strv.h"
if (pipe2(pipe_fds, O_CLOEXEC) < 0)
return log_error_errno(errno, "Failed to allocate pipe: %m");
- r = safe_fork("(getent)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG, &pid);
+ r = safe_fork("(getent)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG|FORK_RLIMIT_NOFILE_SAFE, &pid);
if (r < 0) {
safe_close_pair(pipe_fds);
return r;
(void) close_all_fds(NULL, 0);
- (void) rlimit_nofile_safe();
-
execle("/usr/bin/getent", "getent", database, key, NULL, &empty_env);
execle("/bin/getent", "getent", database, key, NULL, &empty_env);
_exit(EXIT_FAILURE);
#include "missing_syscall.h"
#include "path-util.h"
#include "process-util.h"
-#include "rlimit-util.h"
#include "serialize.h"
#include "set.h"
#include "signal-util.h"
return 0;
}
- r = safe_fork("(direxec)", FORK_DEATHSIG|FORK_LOG, &_pid);
+ r = safe_fork("(direxec)", FORK_DEATHSIG|FORK_LOG|FORK_RLIMIT_NOFILE_SAFE, &_pid);
if (r < 0)
return r;
if (r == 0) {
_exit(EXIT_FAILURE);
}
- (void) rlimit_nofile_safe();
-
if (set_systemd_exec_pid) {
r = setenv_systemd_exec_pid(false);
if (r < 0)
r = safe_fork_full(name,
except,
n_except,
- FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_CLOSE_ALL_FDS|FORK_REOPEN_LOG,
+ FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_CLOSE_ALL_FDS|FORK_REOPEN_LOG|FORK_RLIMIT_NOFILE_SAFE,
ret_pid);
if (r < 0)
return r;
}
}
- (void) rlimit_nofile_safe();
-
/* Count arguments */
va_start(ap, path);
for (n = 0; va_arg(ap, char*); n++)
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
-#include "rlimit-util.h"
#include "signal-util.h"
#include "stdio-util.h"
#include "string-util.h"
log_device_debug(event->dev, "Starting '%s'", cmd);
- r = safe_fork("(spawn)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG, &pid);
+ r = safe_fork("(spawn)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG|FORK_RLIMIT_NOFILE_SAFE, &pid);
if (r < 0)
return log_device_error_errno(event->dev, r,
"Failed to fork() to execute command '%s': %m", cmd);
_exit(EXIT_FAILURE);
(void) close_all_fds(NULL, 0);
- (void) rlimit_nofile_safe();
DEVICE_TRACE_POINT(spawn_exec, event->dev, cmd);