[cgmanager-devel] [PATCH] setup_cgroup_mounts: fix return value
Libo Chen
clbchenlibo.chen at huawei.com
Mon Dec 16 10:11:33 UTC 2013
if return value of snprintf >= MAXPATHLEN, main routine will mistake
setup_cgroup_mounts succeed
Signed-off-by: Libo Chen <clbchenlibo.chen at huawei.com>
---
fs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs.c b/fs.c
index fbc152e..645cd59 100644
--- a/fs.c
+++ b/fs.c
@@ -175,6 +175,7 @@ int setup_cgroup_mounts(void)
ret = snprintf(dest, MAXPATHLEN, "%s/%s", base_path, line);
if (ret < 0 || ret >= MAXPATHLEN) {
nih_fatal("Error calculating pathname for %s and %s", base_path, line);
+ ret = -1;
goto out;
}
if (mkdir(dest, 0755) < 0 && errno != EEXIST) {
--
1.8.2.2
More information about the cgmanager-devel
mailing list