From cb566b5d13642cf960c490fd28235a4a504a8b8f Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 19 Jan 2024 11:30:16 +0900 Subject: namespace-util: downgrade log level in userns_acquire() On failure, the caller logs the error in LOG_ERR. --- src/basic/namespace-util.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/basic/namespace-util.c') diff --git a/src/basic/namespace-util.c b/src/basic/namespace-util.c index 0e81b1de6f..2ecce5fa61 100644 --- a/src/basic/namespace-util.c +++ b/src/basic/namespace-util.c @@ -228,7 +228,7 @@ int userns_acquire(const char *uid_map, const char *gid_map) { r = safe_fork("(sd-mkuserns)", FORK_CLOSE_ALL_FDS|FORK_DEATHSIG_SIGKILL|FORK_NEW_USERNS, &pid); if (r < 0) - return r; + return log_debug_errno(r, "Failed to fork process (sd-mkuserns): %m"); if (r == 0) /* Child. We do nothing here, just freeze until somebody kills us. */ freeze(); @@ -236,12 +236,12 @@ int userns_acquire(const char *uid_map, const char *gid_map) { xsprintf(path, "/proc/" PID_FMT "/uid_map", pid); r = write_string_file(path, uid_map, WRITE_STRING_FILE_DISABLE_BUFFER); if (r < 0) - return log_error_errno(r, "Failed to write UID map: %m"); + return log_debug_errno(r, "Failed to write UID map: %m"); xsprintf(path, "/proc/" PID_FMT "/gid_map", pid); r = write_string_file(path, gid_map, WRITE_STRING_FILE_DISABLE_BUFFER); if (r < 0) - return log_error_errno(r, "Failed to write GID map: %m"); + return log_debug_errno(r, "Failed to write GID map: %m"); r = namespace_open(pid, /* ret_pidns_fd = */ NULL, @@ -250,10 +250,9 @@ int userns_acquire(const char *uid_map, const char *gid_map) { &userns_fd, /* ret_root_fd = */ NULL); if (r < 0) - return log_error_errno(r, "Failed to open userns fd: %m"); + return log_debug_errno(r, "Failed to open userns fd: %m"); return TAKE_FD(userns_fd); - } int in_same_namespace(pid_t pid1, pid_t pid2, NamespaceType type) { -- cgit v1.2.3