From: Christian Brauner Date: Sat, 15 Jul 2017 13:32:52 +0000 (+0200) Subject: storage: default to orig type on identical paths X-Git-Tag: lxc-2.1.0~32^2~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e78e16af028ca984f14dcd392ff8df16cfd8658;p=thirdparty%2Flxc.git storage: default to orig type on identical paths otherwise default to "dir" Signed-off-by: Christian Brauner --- diff --git a/src/lxc/bdev/bdev.c b/src/lxc/bdev/bdev.c index 1bc8afcd0..bef79f70f 100644 --- a/src/lxc/bdev/bdev.c +++ b/src/lxc/bdev/bdev.c @@ -270,6 +270,9 @@ static struct bdev *do_bdev_create(const char *dest, const char *type, struct bdev *bdev; + if (!type) + type = "dir"; + bdev = bdev_get(type); if (!bdev) return NULL; @@ -389,7 +392,11 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname, *needs_rdep = 1; } - new = bdev_get(bdevtype ? bdevtype : orig->type); + if (strcmp(oldpath, lxcpath) && !bdevtype) + bdevtype = "dir"; + else if (!bdevtype) + bdevtype = orig->type; + new = bdev_get(bdevtype); if (!new) { ERROR("no such block device type: %s", bdevtype ? bdevtype : orig->type);