assert(cxt->fs);
assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED));
- if (try_type && !cxt->helper) {
+ if (try_type) {
rc = mnt_context_prepare_helper(cxt, "mount", try_type);
if (rc)
return rc;
return rc;
}
+static int is_success_status(struct libmnt_context *cxt)
+{
+ if (mnt_context_helper_executed(cxt))
+ return mnt_context_get_helper_status(cxt) == 0;
+
+ if (mnt_context_syscall_called(cxt))
+ return mnt_context_get_status(cxt) == 1;
+
+ return 0;
+}
+
/* 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)
{
rc = do_mount(cxt, p);
p = end ? end + 1 : NULL;
free(autotype);
- } while (!mnt_context_get_status(cxt) && p);
+ } while (!is_success_status(cxt) && p);
free(p0);
return rc;
return -MNT_ERR_NOFSTYPE;
for (fp = filesystems; *fp; fp++) {
+ DBG(CXT, ul_debugobj(cxt, " ##### trying '%s'", *fp));
rc = do_mount(cxt, *fp);
- if (mnt_context_get_status(cxt))
+ if (is_success_status(cxt))
break;
if (mnt_context_get_syscall_errno(cxt) != EINVAL &&
mnt_context_get_syscall_errno(cxt) != ENODEV)