]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: propagate first error of multiple filesystem types
authorJohn Keeping <jkeeping@inmusicbrands.com>
Tue, 6 Aug 2024 17:17:29 +0000 (18:17 +0100)
committerJohn Keeping <jkeeping@inmusicbrands.com>
Tue, 6 Aug 2024 17:17:29 +0000 (18:17 +0100)
Use the same error handling logic as do_mount_by_pattern() to better
handle the case where EROFS is returned from the first filesystem in a
list but subsequent filesystems overwrite this status with, for example,
ENODEV.

This allows read-only devices to mount without the user needing to
explicitly specify "ro" while specifying a list of potential
filesystems, some of which may not be available.

Signed-off-by: John Keeping <jkeeping@inmusicbrands.com>
libmount/src/context_mount.c

index dc800c6085dd4152f7ebe4a345992c973a12d35e..e42c8705e2b87028b9b58daa0c5032c444552376 100644 (file)
@@ -630,7 +630,7 @@ static int do_mount_by_types(struct libmnt_context *cxt, const char *types)
                        rc = do_mount(cxt, p);
                p = end ? end + 1 : NULL;
                free(autotype);
-       } while (!is_success_status(cxt) && p);
+       } while (!is_termination_status(cxt) && p);
 
        free(p0);
        return rc;