summaryrefslogtreecommitdiffstats
path: root/mount/mount.c
diff options
context:
space:
mode:
authorKarel Zak2007-11-21 01:46:57 +0100
committerKarel Zak2007-11-21 01:46:57 +0100
commit313c2fbe1fd5864ddaf78d1d253b0581aaaa2188 (patch)
tree4aa1e1d934cf20683b83154f7ff5c2fed5f003d7 /mount/mount.c
parenttests: add ts-mount-noncanonical (diff)
downloadkernel-qcow2-util-linux-313c2fbe1fd5864ddaf78d1d253b0581aaaa2188.tar.gz
kernel-qcow2-util-linux-313c2fbe1fd5864ddaf78d1d253b0581aaaa2188.tar.xz
kernel-qcow2-util-linux-313c2fbe1fd5864ddaf78d1d253b0581aaaa2188.zip
mount: don't call canonicalize(SPEC) for cifs, smbfs and nfs
When calling "mount -t smbfs //foo/bar /mnt/foo", mount.smbfs will be called with /foo/bar if /foo/bar exists locally, and will display its usage. The patch also removes duplicate canonicalize() from mounted() function. Reported-By: Pascal Terjan <pterjan@linuxfr.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'mount/mount.c')
-rw-r--r--mount/mount.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/mount/mount.c b/mount/mount.c
index 4d2fefbbd..60fe4fec9 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -1418,11 +1418,6 @@ mount_one (const char *spec, const char *node, const char *types,
/* Merge the fstab and command line options. */
opts = append_opt(opts, cmdlineopts, NULL);
- /* Handle possible LABEL= and UUID= forms of spec */
- nspec = fsprobe_get_devname_for_mounting(spec);
- if (nspec)
- spec = nspec;
-
if (types == NULL && !mounttype && !is_existing_file(spec)) {
if (strchr (spec, ':') != NULL) {
types = "nfs";
@@ -1439,6 +1434,15 @@ mount_one (const char *spec, const char *node, const char *types,
}
}
+ /* Handle possible LABEL= and UUID= forms of spec */
+ if (types == NULL || (strncmp(types, "nfs", 3) &&
+ strncmp(types, "cifs", 4) &&
+ strncmp(types, "smbfs", 5))) {
+ nspec = fsprobe_get_devname_for_mounting(spec);
+ if (nspec)
+ spec = nspec;
+ }
+
/*
* Try to mount the file system. When the exit status is EX_BG,
* we will retry in the background. Otherwise, we're done.
@@ -1472,15 +1476,14 @@ mount_one (const char *spec, const char *node, const char *types,
static int
mounted (const char *spec0, const char *node0) {
struct mntentchn *mc, *mc0;
- char *spec, *node;
+ const char *spec, *node;
int ret = 0;
/* Handle possible UUID= and LABEL= in spec */
- spec0 = fsprobe_get_devname(spec0);
- if (!spec0)
+ spec = fsprobe_get_devname(spec0);
+ if (!spec)
return ret;
- spec = canonicalize(spec0);
node = canonicalize_mountpoint(node0);
mc0 = mtab_head();