]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxccontainer: create_container_dir()
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 24 Feb 2018 14:30:56 +0000 (15:30 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sat, 24 Feb 2018 20:38:38 +0000 (21:38 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/lxccontainer.c

index 2be6631abc6fe9900e72e8c5b6854625183d0754..117034e8b1d388c460c8c01ca04178e6e5c7b5b9 100644 (file)
@@ -1188,25 +1188,27 @@ static int do_create_container_dir(const char *path, struct lxc_conf *conf)
        return ret;
 }
 
-/*
- * create the standard expected container dir
- */
+/* Create the standard expected container dir. */
 static bool create_container_dir(struct lxc_container *c)
 {
+       int ret;
+       size_t len;
        char *s;
-       int len, ret;
 
        len = strlen(c->config_path) + strlen(c->name) + 2;
        s = malloc(len);
        if (!s)
                return false;
+
        ret = snprintf(s, len, "%s/%s", c->config_path, c->name);
-       if (ret < 0 || ret >= len) {
+       if (ret < 0 || (size_t)ret >= len) {
                free(s);
                return false;
        }
+
        ret = do_create_container_dir(s, c->lxc_conf);
        free(s);
+
        return ret == 0;
 }