[lxc-devel] [lxcfs/master] 2017 02 09/bugfixes

brauner on Github lxc-bot at linuxcontainers.org
Thu Feb 9 10:50:24 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 302 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170209/c017e255/attachment.bin>
-------------- next part --------------
From 94d64a3c2844a71117c4c34d5d74435f61f7668f Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 9 Feb 2017 11:22:50 +0100
Subject: [PATCH 1/4] pam_cgfs: remove dead assignment

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 pam/pam_cgfs.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/pam/pam_cgfs.c b/pam/pam_cgfs.c
index 03111a8..5b61867 100644
--- a/pam/pam_cgfs.c
+++ b/pam/pam_cgfs.c
@@ -1709,8 +1709,6 @@ static ssize_t cg_get_max_cpus(char *cpulist)
 
 	if (!c1 && !c2)
 		c1 = maxcpus;
-	else if (c1 > c2)
-		c2 = c1;
 	else if (c1 < c2)
 		c1 = c2;
 

From eb42e7905918f994c46f8151be32318a56081f9b Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 9 Feb 2017 11:25:30 +0100
Subject: [PATCH 2/4] pam_cgfs: return created directly

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 pam/pam_cgfs.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/pam/pam_cgfs.c b/pam/pam_cgfs.c
index 5b61867..a22d2f8 100644
--- a/pam/pam_cgfs.c
+++ b/pam/pam_cgfs.c
@@ -2154,10 +2154,7 @@ static bool cgv1_create_one(struct cgv1_hierarchy *h, const char *cgroup, uid_t
 		break;
 	}
 
-	if (!created)
-		return false;
-
-	return true;
+	return created;
 }
 
 /* Try to remove @cgroup for all given controllers in a cgroupfs v1 hierarchy

From 68ba129545be78d10e8345924a10f44b337d0145 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 9 Feb 2017 11:36:47 +0100
Subject: [PATCH 3/4] pam_cgfs: make sure that **p is not NULL

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 pam/pam_cgfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pam/pam_cgfs.c b/pam/pam_cgfs.c
index a22d2f8..346b57f 100644
--- a/pam/pam_cgfs.c
+++ b/pam/pam_cgfs.c
@@ -1650,7 +1650,7 @@ static char *string_join(const char *sep, const char **parts, bool use_as_prefix
 	size_t result_len = use_as_prefix * sep_len;
 
 	/* calculate new string length */
-	for (p = (char **)parts; *p; p++)
+	for (p = (char **)parts; p && *p; p++)
 		result_len += (p > (char **)parts) * sep_len + strlen(*p);
 
 	result = calloc(result_len + 1, 1);
@@ -1659,7 +1659,7 @@ static char *string_join(const char *sep, const char **parts, bool use_as_prefix
 
 	if (use_as_prefix)
 		strcpy(result, sep);
-	for (p = (char **)parts; *p; p++) {
+	for (p = (char **)parts; p && *p; p++) {
 		if (p > (char **)parts)
 			strcat(result, sep);
 		strcat(result, *p);

From e7910600c19710337aa134cf0d7fdbb7cdf3d9a1 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 9 Feb 2017 11:49:04 +0100
Subject: [PATCH 4/4] bindings: Want space for ints? Call sizeof(int)!

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 bindings.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bindings.c b/bindings.c
index d748236..97a2164 100644
--- a/bindings.c
+++ b/bindings.c
@@ -4467,7 +4467,7 @@ static void __attribute__((constructor)) collect_and_mount_subsystems(void)
 		goto out;
 	}
 
-	fd_hierarchies = malloc(sizeof(int *) * num_hierarchies);
+	fd_hierarchies = malloc(sizeof(int) * num_hierarchies);
 	if (!fd_hierarchies) {
 		lxcfs_error("%s\n", strerror(errno));
 		goto out;


More information about the lxc-devel mailing list