summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Boccassi <bluca@debian.org>2024-11-27 20:26:41 +0100
committerGitHub <noreply@github.com>2024-11-27 20:26:41 +0100
commit723069188dc6147125de4a0769a8d35d9bae6edb (patch)
tree495c025ebb5d65833479d7a19af692c1c9ac9c54
parentnetwork/queue: do not increase reference counter when remove request is not q... (diff)
parentnsresourced: log about correct errno in userns_destroy_cgroup() (diff)
downloadsystemd-723069188dc6147125de4a0769a8d35d9bae6edb.tar.xz
systemd-723069188dc6147125de4a0769a8d35d9bae6edb.zip
nsresourced: log about correct errno (#35386)
Split out from #35242
-rw-r--r--src/basic/cgroup-util.c6
-rw-r--r--src/nsresourced/userns-registry.c6
2 files changed, 4 insertions, 8 deletions
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
index 8b1e051d56..309dccb45a 100644
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -65,11 +65,7 @@ int cg_cgroupid_open(int cgroupfs_fd, uint64_t id) {
cg_file_handle fh = CG_FILE_HANDLE_INIT;
CG_FILE_HANDLE_CGROUPID(fh) = id;
- int fd = open_by_handle_at(cgroupfs_fd, &fh.file_handle, O_DIRECTORY|O_CLOEXEC);
- if (fd < 0)
- return -errno;
-
- return fd;
+ return RET_NERRNO(open_by_handle_at(cgroupfs_fd, &fh.file_handle, O_DIRECTORY|O_CLOEXEC));
}
static int cg_enumerate_items(const char *controller, const char *path, FILE **ret, const char *item) {
diff --git a/src/nsresourced/userns-registry.c b/src/nsresourced/userns-registry.c
index 8c62e71708..a77ebc589b 100644
--- a/src/nsresourced/userns-registry.c
+++ b/src/nsresourced/userns-registry.c
@@ -530,11 +530,11 @@ static int userns_destroy_cgroup(uint64_t cgroup_id) {
cgroup_fd = cg_cgroupid_open(/* cgroupfsfd= */ -EBADF, cgroup_id);
if (cgroup_fd == -ESTALE) {
- log_debug_errno(cgroup_fd, "Control group %" PRIu64 " already gone, ignoring: %m", cgroup_id);
+ log_debug_errno(cgroup_fd, "Control group %" PRIu64 " already gone, ignoring.", cgroup_id);
return 0;
}
if (cgroup_fd < 0)
- return log_debug_errno(errno, "Failed to open cgroup %" PRIu64 ", ignoring: %m", cgroup_id);
+ return log_debug_errno(cgroup_fd, "Failed to open cgroup %" PRIu64 ", ignoring: %m", cgroup_id);
_cleanup_free_ char *path = NULL;
r = fd_get_path(cgroup_fd, &path);
@@ -547,7 +547,7 @@ static int userns_destroy_cgroup(uint64_t cgroup_id) {
if (isempty(e))
return log_debug_errno(SYNTHETIC_ERRNO(EPERM), "Got root cgroup path, which can't be right, refusing.");
- log_debug("Path of cgroup %" PRIu64 " is: %s", cgroup_id, path);
+ log_debug("Destroying cgroup %" PRIu64 " (%s)", cgroup_id, path);
_cleanup_free_ char *fname = NULL;
r = path_extract_filename(path, &fname);