]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
coverity: #1425889
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 7 Dec 2017 14:21:57 +0000 (15:21 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sun, 17 Dec 2017 15:26:53 +0000 (16:26 +0100)
do not call close on bad file descriptor

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/commands.c

index c7b0306abad3802d4a04538a7089d988eae09c76..b339581002a78eb22bc01880ed714424766bf0c5 100644 (file)
@@ -316,7 +316,8 @@ static int lxc_cmd(const char *name, struct lxc_cmd_rr *cmd, int *stopped,
                *stopped = 1;
 out:
        if (!stay_connected || ret <= 0)
-               close(client_fd);
+               if (client_fd >= 0)
+                       close(client_fd);
 
        if (stay_connected && ret > 0)
                cmd->rsp.ret = client_fd;