Skip to content

Commit

Permalink
lxcapi_clone: exit early on snapshot clones
Browse files Browse the repository at this point in the history
If the user explicitly asks for a snapshot clone (in which
case maybe_snap is not set), we cannot abide this currently.
Rather than exit later with more cryptic error messages, exit
out early.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
  • Loading branch information
hallyn authored and stgraber committed Jan 25, 2014
1 parent 691ac4a commit 0bc8db6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lxc/bdev.c
Expand Up @@ -2101,6 +2101,11 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname,

/* check for privilege */
if (am_unpriv()) {
if (snap && !maybe_snap) {
ERROR("Unprivileged users cannot snapshot");
bdev_put(orig);
return NULL;
}
if (bdevtype && strcmp(bdevtype, "dir") != 0) {
ERROR("Unprivileged users can only make dir copy-clones");
bdev_put(orig);
Expand Down

0 comments on commit 0bc8db6

Please sign in to comment.