Skip to content

Commit

Permalink
lxccontainer: create_partial()
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Aug 23, 2018
1 parent 7f15d31 commit de487bb
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/lxc/lxccontainer.c
Expand Up @@ -206,19 +206,21 @@ static int create_partial(struct lxc_container *c)

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;
size_t len;
char *path;

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);
if (ret < 0 || ret >= len) {
ERROR("Error writing partial pathname");
if (ret < 0 || (size_t)ret >= len)
return;
}
if (unlink(path) < 0)
SYSERROR("Error unlink partial file %s", path);

ret = unlink(path);
if (ret < 0)
SYSERROR("Failed to remove partial file %s", path);
}

/* LOCKING
Expand Down

0 comments on commit de487bb

Please sign in to comment.