aboutsummaryrefslogtreecommitdiffstats
path: root/libmount/src
diff options
context:
space:
mode:
Diffstat (limited to 'libmount/src')
-rw-r--r--libmount/src/context_mount.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c
index a685acc161..dc800c6085 100644
--- a/libmount/src/context_mount.c
+++ b/libmount/src/context_mount.c
@@ -581,6 +581,15 @@ static int is_success_status(struct libmnt_context *cxt)
return 0;
}
+static int is_termination_status(struct libmnt_context *cxt)
+{
+ if (is_success_status(cxt))
+ return 1;
+
+ return mnt_context_get_syscall_errno(cxt) != EINVAL &&
+ mnt_context_get_syscall_errno(cxt) != ENODEV;
+}
+
/* try mount(2) for all items in comma separated list of the filesystem @types */
static int do_mount_by_types(struct libmnt_context *cxt, const char *types)
{
@@ -666,10 +675,7 @@ static int do_mount_by_pattern(struct libmnt_context *cxt, const char *pattern)
for (fp = filesystems; *fp; fp++) {
DBG(CXT, ul_debugobj(cxt, " ##### trying '%s'", *fp));
rc = do_mount(cxt, *fp);
- if (is_success_status(cxt))
- break;
- if (mnt_context_get_syscall_errno(cxt) != EINVAL &&
- mnt_context_get_syscall_errno(cxt) != ENODEV)
+ if (is_termination_status(cxt))
break;
}
mnt_free_filesystems(filesystems);