lxccontainer: create_container_dir()

parent 78d44e5a
...@@ -1188,25 +1188,27 @@ static int do_create_container_dir(const char *path, struct lxc_conf *conf) ...@@ -1188,25 +1188,27 @@ static int do_create_container_dir(const char *path, struct lxc_conf *conf)
return ret; return ret;
} }
/* /* Create the standard expected container dir. */
* create the standard expected container dir
*/
static bool create_container_dir(struct lxc_container *c) static bool create_container_dir(struct lxc_container *c)
{ {
int ret;
size_t len;
char *s; char *s;
int len, ret;
len = strlen(c->config_path) + strlen(c->name) + 2; len = strlen(c->config_path) + strlen(c->name) + 2;
s = malloc(len); s = malloc(len);
if (!s) if (!s)
return false; return false;
ret = snprintf(s, len, "%s/%s", c->config_path, c->name); 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); free(s);
return false; return false;
} }
ret = do_create_container_dir(s, c->lxc_conf); ret = do_create_container_dir(s, c->lxc_conf);
free(s); free(s);
return ret == 0; return ret == 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment