]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mountfsd: return a better error when invalid file flags are specified on image fd
authorLennart Poettering <lennart@poettering.net>
Wed, 3 Dec 2025 08:38:50 +0000 (09:38 +0100)
committerLennart Poettering <lennart@poettering.net>
Sun, 21 Dec 2025 06:04:42 +0000 (07:04 +0100)
We already defined an error for this that we return for invalid dir fds
passed in, let's add the same niceness to the image fds.

src/mountfsd/mountwork.c

index 4c321ce1c07e4489bf14e91787b8f828d8fddb41..7de8784e326d0eab8ed38992af8c633b1e3df286 100644 (file)
@@ -353,6 +353,8 @@ static int vl_method_mount_image(
         }
 
         r = validate_image_fd(image_fd, &p);
+        if (r == -EREMOTEIO)
+                return sd_varlink_errorbo(link, "io.systemd.MountFileSystem.BadFileDescriptorFlags", SD_JSON_BUILD_PAIR_STRING("parameter", "imageFileDescriptor"));
         if (r < 0)
                 return r;