aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-12-05 14:14:11 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2020-12-05 14:14:11 +0100
commitb1eedfcfa1d2281b2e1b8773ab0130c5196b4505 (patch)
treef565a7adc4c216fccb3eeb2782ef8b8a70aa03c3
parent758c2bd58e0a23cdf19be8bd7c963074aff54b50 (diff)
downloadbusybox-w32-b1eedfcfa1d2281b2e1b8773ab0130c5196b4505.tar.gz
busybox-w32-b1eedfcfa1d2281b2e1b8773ab0130c5196b4505.tar.bz2
busybox-w32-b1eedfcfa1d2281b2e1b8773ab0130c5196b4505.zip
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>
-rw-r--r--util-linux/mount.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c
index dba583544..7625d8424 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -2064,14 +2064,18 @@ static int singlemount(struct mntent *mp, int ignore_busy)
2064 } 2064 }
2065 2065
2066 // Might this be an NFS filesystem? 2066 // Might this be an NFS filesystem?
2067 if ((!mp->mnt_type || is_prefixed_with(mp->mnt_type, "nfs")) 2067 if (!(vfsflags & (MS_BIND | MS_MOVE))
2068 && strchr(mp->mnt_fsname, ':') != NULL 2068 && (!mp->mnt_type || is_prefixed_with(mp->mnt_type, "nfs"))
2069 && !(vfsflags & (MS_REMOUNT | MS_BIND | MS_MOVE))
2070 ) { 2069 ) {
2071 if (!mp->mnt_type) 2070 char *colon = strchr(mp->mnt_fsname, ':');
2072 mp->mnt_type = (char*)"nfs"; 2071 if (colon /* looks like "hostname:..." */
2073 rc = nfsmount(mp, vfsflags, filteropts); 2072 && strchrnul(mp->mnt_fsname, '/') > colon /* "hostname:" has no slashes */
2074 goto report_error; 2073 ) {
2074 if (!mp->mnt_type)
2075 mp->mnt_type = (char*)"nfs";
2076 rc = nfsmount(mp, vfsflags, filteropts);
2077 goto report_error;
2078 }
2075 } 2079 }
2076 2080
2077 // Look at the file. (Not found isn't a failure for remount, or for 2081 // Look at the file. (Not found isn't a failure for remount, or for