[lxc-devel] [lxc/master] [cgfsng] show wrong errno

duguhaotian on Github lxc-bot at linuxcontainers.org
Fri Jan 26 13:11:23 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 892 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180126/c2c062d0/attachment.bin>
-------------- next part --------------
From d1953b26c87864808ce77958cccaeac69440fd17 Mon Sep 17 00:00:00 2001
From: duguhaotian <duguhaotian at gmail.com>
Date: Fri, 26 Jan 2018 21:07:58 +0800
Subject: [PATCH] [cgfsng] show wrong errno

lxc_cgroup_set_data: h = get_hierarchy(controller);
if h is NULL, now errno is old, it donot set new one.
And then,
cgfsng_setup_limits:

    if (lxc_cgroup_set_data(cg->subsystem, cg->value, d)) {
		if (do_devices && (errno == EACCES ||
			errno == EPERM)) {
			WARN("Error setting %s to %s for %s",
				cg->subsystem, cg->value,
				d->name);
			continue;
		}
		SYSERROR("Error setting %s to %s for
			 %s",
			 cg->subsystem, cg->value,
			 d->name);
		goto out;
	}

SYSERROR will show old errno, make me confused.

Signed-off-by: duguhaotian <duguhaotian at gmail.com>
---
 src/lxc/cgroups/cgfsng.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c
index 2d1ad4ebb..027d369e8 100644
--- a/src/lxc/cgroups/cgfsng.c
+++ b/src/lxc/cgroups/cgfsng.c
@@ -2143,6 +2143,7 @@ static int lxc_cgroup_set_data(const char *filename, const char *value, struct c
 		      "The controller seems to be unused by \"cgfsng\" cgroup "
 		      "driver or not enabled on the cgroup hierarchy",
 		      controller);
+		errno = ENOENT;
 		return -1;
 	}
 


More information about the lxc-devel mailing list