From: John Keeping Date: Tue, 6 Aug 2024 17:17:29 +0000 (+0100) Subject: libmount: propagate first error of multiple filesystem types X-Git-Tag: v2.40.3~18 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=859a1e49a7ab2b1df453c2537f461a87d299936c;p=thirdparty%2Futil-linux.git libmount: propagate first error of multiple filesystem types 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 (cherry picked from commit e2b3f9915333b6e423e1f47d3f5e7cc6ea0ff482) --- diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c index a75d1ed52..22892f3f6 100644 --- a/libmount/src/context_mount.c +++ b/libmount/src/context_mount.c @@ -626,7 +626,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;