]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxccontainer: satisfy coverity
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 8 Feb 2018 14:57:02 +0000 (15:57 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 9 Feb 2018 09:37:53 +0000 (10:37 +0100)
The container name can't be NULL so don't give coverity the impression that it
could be.

Silences coverity #1426123.
Silences coverity #1426124.

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

index 465d27fb82ca0f1c459bc66fa3bf9ad2181f9ad1..f0191c1778c6502ad96830f2d3bfcfd6c9291e0a 100644 (file)
@@ -2727,7 +2727,7 @@ static bool container_destroy(struct lxc_container *c,
 
        if (conf && !lxc_list_empty(&conf->hooks[LXCHOOK_DESTROY])) {
                /* Start of environment variable setup for hooks */
-               if (c->name && setenv("LXC_NAME", c->name, 1))
+               if (setenv("LXC_NAME", c->name, 1))
                        SYSERROR("Failed to set environment variable for container name");
 
                if (conf->rcfile && setenv("LXC_CONFIG_FILE", conf->rcfile, 1))
@@ -3425,7 +3425,7 @@ static int clone_update_rootfs(struct clone_update_data *data)
                if (c0->name && setenv("LXC_SRC_NAME", c0->name, 1)) {
                        SYSERROR("failed to set environment variable for source container name");
                }
-               if (c->name && setenv("LXC_NAME", c->name, 1)) {
+               if (setenv("LXC_NAME", c->name, 1)) {
                        SYSERROR("failed to set environment variable for container name");
                }
                if (conf->rcfile && setenv("LXC_CONFIG_FILE", conf->rcfile, 1)) {