From: Christian Brauner Date: Wed, 28 Apr 2021 09:23:03 +0000 (+0200) Subject: storage/dir: use clear error messages X-Git-Tag: lxc-5.0.0~188^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2e3c938784bc3a857c714231734e99141e4ecff;p=thirdparty%2Flxc.git storage/dir: use clear error messages Signed-off-by: Christian Brauner --- diff --git a/src/lxc/storage/dir.c b/src/lxc/storage/dir.c index 38f8616b3..36eb30690 100644 --- a/src/lxc/storage/dir.c +++ b/src/lxc/storage/dir.c @@ -133,11 +133,14 @@ int dir_mount(struct lxc_storage *bdev) int ret; const char *src; - if (strcmp(bdev->type, "dir")) - return -22; + if (!strequal(bdev->type, "dir")) + return syserror_set(-EINVAL, "Invalid storage driver"); - if (!bdev->src || !bdev->dest) - return -22; + if (is_empty_string(bdev->src)) + return syserror_set(-EINVAL, "Missing rootfs path"); + + if (is_empty_string(bdev->dest)) + return syserror_set(-EINVAL, "Missing target mountpoint"); src = lxc_storage_get_path(bdev->src, bdev->type);