summaryrefslogtreecommitdiff
path: root/src/nspawn
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-02-07 14:33:06 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-02-07 14:39:49 +0900
commitf3f2d02e9731e65eb15c26980305cd47e028f4fc (patch)
treea9658f0e205450dd16279d9881ed301fb3d0ab95 /src/nspawn
parente955a7f460adadf54da7bfb62f04cbff16ca5941 (diff)
downloadsystemd-f3f2d02e9731e65eb15c26980305cd47e028f4fc.tar.gz
tree-wide: set FORK_RLIMIT_NOFILE_SAFE flag
No functional changes, just refactoring.
Diffstat (limited to 'src/nspawn')
-rw-r--r--src/nspawn/nspawn-setuid.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/nspawn/nspawn-setuid.c b/src/nspawn/nspawn-setuid.c
index e396d66441..5772d96b2f 100644
--- a/src/nspawn/nspawn-setuid.c
+++ b/src/nspawn/nspawn-setuid.c
@@ -12,7 +12,6 @@
#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"
@@ -29,7 +28,7 @@ static int spawn_getent(const char *database, const char *key, pid_t *rpid) {
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;
@@ -44,8 +43,6 @@ static int spawn_getent(const char *database, const char *key, pid_t *rpid) {
(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);