[lxc-devel] [lxc/master] conf: avoid compiler warning

brauner on Github lxc-bot at linuxcontainers.org
Tue Mar 5 18:30:47 UTC 2019


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/20190305/d3c885e5/attachment.bin>
-------------- next part --------------
From 1ae05901cc71a1f515b82e8d587fe7b6e8376bfd Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Tue, 5 Mar 2019 19:28:52 +0100
Subject: [PATCH 1/2] Revert "conf: Fixes unitialised variable."

This reverts commit 912c4bb474b52284cf82c336b0af161be6c25ac1.

I accidently merged this commit. The initialization is wrong.

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

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 60e4ebaa70..794a36fef9 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -2770,7 +2770,7 @@ struct lxc_conf *lxc_conf_init(void)
 int write_id_mapping(enum idtype idtype, pid_t pid, const char *buf,
 		     size_t buf_size)
 {
-	__do_close_prot_errno int fd = 0;
+	__do_close_prot_errno int fd;
 	int ret;
 	char path[PATH_MAX];
 

From 41e0074919d59500c4d010fb948e003f167a9113 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Tue, 5 Mar 2019 19:29:38 +0100
Subject: [PATCH 2/2] conf: avoid compiler warning

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

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 794a36fef9..5d381b7137 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -2770,7 +2770,7 @@ struct lxc_conf *lxc_conf_init(void)
 int write_id_mapping(enum idtype idtype, pid_t pid, const char *buf,
 		     size_t buf_size)
 {
-	__do_close_prot_errno int fd;
+	__do_close_prot_errno int fd = -EBADF;
 	int ret;
 	char path[PATH_MAX];
 


More information about the lxc-devel mailing list