diff options
author | Denys Vlasenko | 2020-12-05 14:14:11 +0100 |
---|---|---|
committer | Denys Vlasenko | 2020-12-05 14:14:11 +0100 |
commit | b1eedfcfa1d2281b2e1b8773ab0130c5196b4505 (patch) | |
tree | f565a7adc4c216fccb3eeb2782ef8b8a70aa03c3 /util-linux/mount.c | |
parent | 758c2bd58e0a23cdf19be8bd7c963074aff54b50 (diff) | |
download | busybox-b1eedfcfa1d2281b2e1b8773ab0130c5196b4505.zip busybox-b1eedfcfa1d2281b2e1b8773ab0130c5196b4505.tar.gz |
mount: do not guess mount as NFS if "hostname:" contains slashes
function old new delta
singlemount 1273 1295 +22
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/mount.c')
-rw-r--r-- | util-linux/mount.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c index dba5835..7625d84 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -2064,14 +2064,18 @@ static int singlemount(struct mntent *mp, int ignore_busy) } // Might this be an NFS filesystem? - if ((!mp->mnt_type || is_prefixed_with(mp->mnt_type, "nfs")) - && strchr(mp->mnt_fsname, ':') != NULL - && !(vfsflags & (MS_REMOUNT | MS_BIND | MS_MOVE)) + if (!(vfsflags & (MS_BIND | MS_MOVE)) + && (!mp->mnt_type || is_prefixed_with(mp->mnt_type, "nfs")) ) { - if (!mp->mnt_type) - mp->mnt_type = (char*)"nfs"; - rc = nfsmount(mp, vfsflags, filteropts); - goto report_error; + char *colon = strchr(mp->mnt_fsname, ':'); + if (colon /* looks like "hostname:..." */ + && strchrnul(mp->mnt_fsname, '/') > colon /* "hostname:" has no slashes */ + ) { + if (!mp->mnt_type) + mp->mnt_type = (char*)"nfs"; + rc = nfsmount(mp, vfsflags, filteropts); + goto report_error; + } } // Look at the file. (Not found isn't a failure for remount, or for |