[lxc-devel] [lxc/master] commands: make sure to include compiler.h

brauner on Github lxc-bot at linuxcontainers.org
Tue Mar 10 21:42:56 UTC 2020


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/20200310/c565fcea/attachment.bin>
-------------- next part --------------
From 95d8f32353789256c077ace1334838c0d871c2e1 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Tue, 10 Mar 2020 22:33:00 +0100
Subject: [PATCH] commands: make sure to include compiler.h

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

diff --git a/src/lxc/commands.c b/src/lxc/commands.c
index cf3b1ed223..247807c868 100644
--- a/src/lxc/commands.c
+++ b/src/lxc/commands.c
@@ -1327,8 +1327,7 @@ static void lxc_cmd_fd_cleanup(int fd, struct lxc_handler *handler,
 	lxc_terminal_free(handler->conf, fd);
 	lxc_mainloop_del_handler(descr, fd);
 
-	switch (cmd) {
-	case LXC_CMD_ADD_STATE_CLIENT:
+	if (cmd == LXC_CMD_ADD_STATE_CLIENT) {
 		lxc_list_for_each_safe(cur, &handler->conf->state_clients, next) {
 			struct lxc_state_client *client = cur->elem;
 
@@ -1344,7 +1343,8 @@ static void lxc_cmd_fd_cleanup(int fd, struct lxc_handler *handler,
 			 * No need to walk the whole list. If we found the state
 			 * client fd there can't be a second one.
 			 */
-			break;
+			TRACE("Closed state client fd %d\n", fd);
+			return;
 		}
 
 		/*
@@ -1353,10 +1353,10 @@ static void lxc_cmd_fd_cleanup(int fd, struct lxc_handler *handler,
 		 * was already reached by the time we were ready to add it. So
 		 * fallthrough and clean it up.
 		 */
-		__fallthrough;
-	default:
-		close(fd);
+		TRACE("Closing state client fd %d not present in state client list\n", fd);
 	}
+
+	close(fd);
 }
 
 static int lxc_cmd_handler(int fd, uint32_t events, void *data,


More information about the lxc-devel mailing list