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>
/* 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);