From e2e3c938784bc3a857c714231734e99141e4ecff Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Wed, 28 Apr 2021 11:23:03 +0200 Subject: [PATCH] storage/dir: use clear error messages Signed-off-by: Christian Brauner --- src/lxc/storage/dir.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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); -- 2.47.2