[lxc-devel] [lxc/master] terminal: remove unneeded if condition

brauner on Github lxc-bot at linuxcontainers.org
Mon May 4 13:59:18 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 390 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200504/3553d5a7/attachment.bin>
-------------- next part --------------
From af25cae409b423ee779eef0ac388fa6758ea5f97 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Mon, 4 May 2020 15:50:41 +0200
Subject: [PATCH] terminal: remove unneeded if condition

Fixes: Coverity 1461742.
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/terminal.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/lxc/terminal.c b/src/lxc/terminal.c
index c2516b205a..c883b1c8cf 100644
--- a/src/lxc/terminal.c
+++ b/src/lxc/terminal.c
@@ -1167,10 +1167,7 @@ int lxc_terminal_map_ids(struct lxc_conf *c, struct lxc_terminal *terminal)
 	if (strcmp(terminal->name, "") == 0)
 		return 0;
 
-	if (terminal->slave >= 0)
-		ret = userns_exec_mapped_root(terminal->name, terminal->slave, c);
-	else
-		ret = userns_exec_mapped_root(terminal->name, terminal->slave, c);
+	ret = userns_exec_mapped_root(terminal->name, terminal->slave, c);
 	if (ret < 0) {
 		return log_error(-1, "Failed to chown terminal %d(%s)",
 				 terminal->slave, terminal->name);


More information about the lxc-devel mailing list