diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-01-19 02:46:20 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-01-19 07:06:08 +0100 |
commit | d2881ef96ec63c29a4ed41a23133068c821c4fb0 (patch) | |
tree | 90fbfbf9b0472fefd6ece530da6833d2109428c4 /src/shared/machine-id-setup.c | |
parent | namespace-util: rename arguments to prefix 'ret_' (diff) | |
download | systemd-d2881ef96ec63c29a4ed41a23133068c821c4fb0.tar.xz systemd-d2881ef96ec63c29a4ed41a23133068c821c4fb0.zip |
tree-wide: add short comments for namespace_open() and namespace_enter()
Also use -EBADF when unspecified.
Diffstat (limited to 'src/shared/machine-id-setup.c')
-rw-r--r-- | src/shared/machine-id-setup.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/shared/machine-id-setup.c b/src/shared/machine-id-setup.c index d6aa667ada..833c98b88e 100644 --- a/src/shared/machine-id-setup.c +++ b/src/shared/machine-id-setup.c @@ -265,7 +265,12 @@ int machine_id_commit(const char *root) { fd = safe_close(fd); /* Store current mount namespace */ - r = namespace_open(0, NULL, &initial_mntns_fd, NULL, NULL, NULL); + r = namespace_open(0, + /* ret_pidns_fd = */ NULL, + &initial_mntns_fd, + /* ret_netns_fd = */ NULL, + /* ret_userns_fd = */ NULL, + /* ret_root_fd = */ NULL); if (r < 0) return log_error_errno(r, "Can't fetch current mount namespace: %m"); @@ -284,7 +289,11 @@ int machine_id_commit(const char *root) { return log_error_errno(r, "Cannot write %s. This is mandatory to get a persistent machine ID: %m", etc_machine_id); /* Return to initial namespace and proceed a lazy tmpfs unmount */ - r = namespace_enter(-1, initial_mntns_fd, -1, -1, -1); + r = namespace_enter(/* pidns_fd = */ -EBADF, + initial_mntns_fd, + /* netns_fd = */ -EBADF, + /* userns_fd = */ -EBADF, + /* root_fd = */ -EBADF); if (r < 0) return log_warning_errno(r, "Failed to switch back to initial mount namespace: %m.\nWe'll keep transient %s file until next reboot.", etc_machine_id); |