[lxc-devel] [lxc/master] bugfixes

brauner on Github lxc-bot at linuxcontainers.org
Mon Jan 8 17:28:16 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180108/7c891e7e/attachment.bin>
-------------- next part --------------
From 6c6953c1b340c8cca007f8203fb3db5fdad09462 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Mon, 8 Jan 2018 18:24:41 +0100
Subject: [PATCH 1/2] coverity: #1427191

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/conf.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index affc41e16..6e3832f54 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -2656,15 +2656,17 @@ int write_id_mapping(enum idtype idtype, pid_t pid, const char *buf,
 			return -1;
 		}
 
-		buflen = sizeof("deny\n") - 1;
-		errno = 0;
-		ret = lxc_write_nointr(fd, "deny\n", buflen);
-		if (ret != buflen) {
-			SYSERROR("Failed to write \"deny\" to \"/proc/%d/setgroups\"", pid);
+		if (fd >= 0) {
+			buflen = sizeof("deny\n") - 1;
+			errno = 0;
+			ret = lxc_write_nointr(fd, "deny\n", buflen);
+			if (ret != buflen) {
+				SYSERROR("Failed to write \"deny\" to \"/proc/%d/setgroups\"", pid);
+				close(fd);
+				return -1;
+			}
 			close(fd);
-			return -1;
 		}
-		close(fd);
 	}
 
 	ret = snprintf(path, MAXPATHLEN, "/proc/%d/%cid_map", pid,

From 7e7846c57f84031350daaacbfb7a934c8f662e82 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Mon, 8 Jan 2018 18:25:56 +0100
Subject: [PATCH 2/2] coverity: #1427190

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/cgroups/cgfsng.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c
index 2d1ad4ebb..5350ddcda 100644
--- a/src/lxc/cgroups/cgfsng.c
+++ b/src/lxc/cgroups/cgfsng.c
@@ -1221,9 +1221,6 @@ static int recursive_destroy(char *dirname)
 		char *pathname;
 		struct stat mystat;
 
-		if (!direntp)
-			break;
-
 		if (!strcmp(direntp->d_name, ".") ||
 		    !strcmp(direntp->d_name, ".."))
 			continue;


More information about the lxc-devel mailing list