diff options
author | Karel Zak | 2014-06-23 12:42:33 +0200 |
---|---|---|
committer | Karel Zak | 2014-06-23 12:42:33 +0200 |
commit | b1f03df7983975919b2d2f6eaa3175212ce61bee (patch) | |
tree | ce2c3423924066ee8fac60cfa90731a81afeedc5 /libmount/src/context_mount.c | |
parent | hwclock: sometimes one day lasts 23 hours. (diff) | |
download | kernel-qcow2-util-linux-b1f03df7983975919b2d2f6eaa3175212ce61bee.tar.gz kernel-qcow2-util-linux-b1f03df7983975919b2d2f6eaa3175212ce61bee.tar.xz kernel-qcow2-util-linux-b1f03df7983975919b2d2f6eaa3175212ce61bee.zip |
libmount: special treatment for auto in fstype pattern
Let's support
mount -t ext2,auto /dev/sde /media/stick
Reported-by: Andreas Henriksson <andreas@fatal.se>
Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=506695
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/context_mount.c')
-rw-r--r-- | libmount/src/context_mount.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c index dcfdabfd2..14ae65254 100644 --- a/libmount/src/context_mount.c +++ b/libmount/src/context_mount.c @@ -773,18 +773,36 @@ static int do_mount_by_pattern(struct libmnt_context *cxt, const char *pattern) */ char *p, *p0; - DBG(CXT, ul_debugobj(cxt, "trying to mount by FS pattern list")); + DBG(CXT, ul_debugobj(cxt, "trying to mount by FS pattern list '%s'", pattern)); p0 = p = strdup(pattern); if (!p) return -ENOMEM; do { + char *autotype = NULL; char *end = strchr(p, ','); + if (end) *end = '\0'; - rc = do_mount(cxt, p); - p = end ? end + 1 : NULL; + DBG(CXT, ul_debugobj(cxt, "-->trying '%s'", p)); + + /* Let's support things like "udf,iso9660,auto" */ + if (strcmp(p, "auto") == 0) { + rc = mnt_context_guess_srcpath_fstype(cxt, &autotype); + if (rc) { + DBG(CXT, ul_debugobj(cxt, "failed to guess FS type")); + free(p0); + return rc; + } + p = autotype; + DBG(CXT, ul_debugobj(cxt, " --> '%s'", p)); + } + + if (p) + rc = do_mount(cxt, p); + p = end ? end + 1 : NULL; + free(autotype); } while (!mnt_context_get_status(cxt) && p); free(p0); |