Commit 0bc8db6b by Serge Hallyn Committed by Stéphane Graber

lxcapi_clone: exit early on snapshot clones

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: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com> Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent 691ac4a3
......@@ -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);
......
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