diff options
-rw-r--r-- | libmount/src/context.c | 10 | ||||
-rw-r--r-- | libmount/src/context_mount.c | 10 |
2 files changed, 13 insertions, 7 deletions
diff --git a/libmount/src/context.c b/libmount/src/context.c index ad97dc8e7..721c497ef 100644 --- a/libmount/src/context.c +++ b/libmount/src/context.c @@ -714,15 +714,14 @@ const char *mnt_context_get_target(struct libmnt_context *cxt) * @cxt: mount context * @fstype: filesystem type * - * Note that the @fstype has to be the real FS type. For comma-separated list of - * filesystems or for "nofs" notation use mnt_context_set_fstype_pattern(). + * Note that the @fstype has to be the real FS type. For patterns with + * comma-separated list of filesystems or for "nofs" notation use + * mnt_context_set_fstype_pattern(). * * Returns: 0 on success, negative number in case of error. */ int mnt_context_set_fstype(struct libmnt_context *cxt, const char *fstype) { - if (fstype && strchr(fstype, ',')) - return -EINVAL; return mnt_fs_set_fstype(mnt_context_get_fs(cxt), fstype); } @@ -1482,6 +1481,9 @@ int mnt_context_prepare_helper(struct libmnt_context *cxt, const char *name, if (!type) type = mnt_fs_get_fstype(cxt->fs); + if (type && strchr(type, ',')) + return 0; /* type is fstype pattern */ + if (mnt_context_is_nohelpers(cxt) || !type || !strcmp(type, "none") diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c index 6dc8e6486..1e21db7c6 100644 --- a/libmount/src/context_mount.c +++ b/libmount/src/context_mount.c @@ -690,9 +690,13 @@ int mnt_context_do_mount(struct libmnt_context *cxt) cxt->mountdata = (char *) mnt_fs_get_fs_options(cxt->fs); type = mnt_fs_get_fstype(cxt->fs); - if (type) - res = do_mount(cxt, NULL); - else + if (type) { + if (strchr(type, ',')) + /* this only happen if fstab countains list of filesystems */ + res = do_mount_by_pattern(cxt, type); + else + res = do_mount(cxt, NULL); + } else res = do_mount_by_pattern(cxt, cxt->fstype_pattern); if (mnt_context_get_status(cxt) |