]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
storage/dir: use clear error messages
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 28 Apr 2021 09:23:03 +0000 (11:23 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 28 Apr 2021 09:23:03 +0000 (11:23 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/storage/dir.c

index 38f8616b33ed46e35d0cc6aec5e53546ebc0e283..36eb30690d5e3a245d5e4a737ef14b738c1f7022 100644 (file)
@@ -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);