[lxc-devel] [lxc/master] cgfsng: fix is_lxcfs() and is_cgroupfs()
brauner on Github
lxc-bot at linuxcontainers.org
Mon Jul 25 15:17:28 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 498 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160725/c2025a20/attachment.bin>
-------------- next part --------------
From ae9d5b370b39f4900cd2bef7daa44b0cd1fe794d Mon Sep 17 00:00:00 2001
From: Christian Brauner <cbrauner at suse.de>
Date: Mon, 25 Jul 2016 17:10:47 +0200
Subject: [PATCH] cgfsng: fix is_lxcfs() and is_cgroupfs()
Both functions advertise that they return true when strncmp() == 0 and false
when strncmp() != 0 but so far they returned the exact opposite.
Signed-off-by: Christian Brauner <cbrauner at suse.de>
---
src/lxc/cgfsng.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/lxc/cgfsng.c b/src/lxc/cgfsng.c
index 0ea7b39..16a9457 100644
--- a/src/lxc/cgfsng.c
+++ b/src/lxc/cgfsng.c
@@ -438,7 +438,7 @@ static bool is_lxcfs(const char *line)
char *p = strstr(line, " - ");
if (!p)
return false;
- return strncmp(p, " - fuse.lxcfs ", 14);
+ return strncmp(p, " - fuse.lxcfs ", 14) == 0;
}
/*
@@ -488,7 +488,7 @@ static bool is_cgroupfs(char *line)
char *p = strstr(line, " - ");
if (!p)
return false;
- return strncmp(p, " - cgroup ", 10);
+ return strncmp(p, " - cgroup ", 10) == 0;
}
/* Add a controller to our list of hierarchies */
@@ -1350,7 +1350,7 @@ static bool cgfsng_mount(void *hdata, const char *root, int type)
free(controllerpath);
goto bad;
}
-
+
r = do_secondstage_mounts_if_needed(type, h, controllerpath, path2,
d->container_cgroup);
free(controllerpath);
More information about the lxc-devel
mailing list