lxccontainer: create_partial()

parent f5cd0252
...@@ -207,19 +207,21 @@ static int create_partial(struct lxc_container *c) ...@@ -207,19 +207,21 @@ static int create_partial(struct lxc_container *c)
static void remove_partial(struct lxc_container *c, int fd) static void remove_partial(struct lxc_container *c, int fd)
{ {
/* $lxcpath + '/' + $name + '/partial' + \0 */
int len = strlen(c->config_path) + strlen(c->name) + 10;
char *path = alloca(len);
int ret; int ret;
size_t len;
char *path;
close(fd); close(fd);
/* $lxcpath + '/' + $name + '/partial' + \0 */
len = strlen(c->config_path) + strlen(c->name) + 10;
path = alloca(len);
ret = snprintf(path, len, "%s/%s/partial", c->config_path, c->name); ret = snprintf(path, len, "%s/%s/partial", c->config_path, c->name);
if (ret < 0 || ret >= len) { if (ret < 0 || (size_t)ret >= len)
ERROR("Error writing partial pathname");
return; return;
}
if (unlink(path) < 0) ret = unlink(path);
SYSERROR("Error unlink partial file %s", path); if (ret < 0)
SYSERROR("Failed to remove partial file %s", path);
} }
/* LOCKING /* LOCKING
......
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