tree-wide: pass EBADF to fd params of namespace_fork()

This commit is contained in:
Lennart Poettering
2025-02-18 12:11:00 +01:00
parent fff6dfc75e
commit 8e0193aabf
2 changed files with 18 additions and 8 deletions
+6 -6
View File
@@ -230,11 +230,11 @@ int machine_get_addresses(Machine *machine, struct local_address **ret_addresses
/* except_fds = */ NULL,
/* n_except_fds = */ 0,
FORK_RESET_SIGNALS|FORK_DEATHSIG_SIGKILL,
/* pidns_fd = */ -1,
/* mntns_fd = */ -1,
/* pidns_fd = */ -EBADF,
/* mntns_fd = */ -EBADF,
netns_fd,
/* userns_fd = */ -1,
/* root_fd = */ -1,
/* userns_fd = */ -EBADF,
/* root_fd = */ -EBADF,
&child);
if (r < 0)
return log_debug_errno(r, "Failed to fork(): %m");
@@ -347,8 +347,8 @@ int machine_get_os_release(Machine *machine, char ***ret_os_release) {
FORK_RESET_SIGNALS|FORK_DEATHSIG_SIGKILL,
pidns_fd,
mntns_fd,
/* netns_fd = */ -1,
/* userns_fd = */ -1,
/* netns_fd = */ -EBADF,
/* userns_fd = */ -EBADF,
root_fd,
&child);
if (r < 0)
+12 -2
View File
@@ -1038,8 +1038,18 @@ static int mount_in_namespace_legacy(
goto finish;
}
r = namespace_fork("(sd-bindmnt)", "(sd-bindmnt-inner)", NULL, 0, FORK_RESET_SIGNALS|FORK_DEATHSIG_SIGTERM,
pidns_fd, mntns_fd, -1, -1, root_fd, &child);
r = namespace_fork(
"(sd-bindmnt)",
"(sd-bindmnt-inner)",
/* except_fds= */ NULL,
/* n_except_fds= */ 0,
FORK_RESET_SIGNALS|FORK_DEATHSIG_SIGTERM,
pidns_fd,
mntns_fd,
/* netns_fd= */ -EBADF,
/* userns_fd= */ -EBADF,
root_fd,
&child);
if (r < 0)
goto finish;
if (r == 0) {