← Commit list

b1eedfcfa

Denys Vlasenko
Denys Vlasenko
2020-12-05
SUCCESS Duration: 152s

Subject

mount: do not guess mount as NFS if "hostname:" contains slashes

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

util-linux/mount.c+11 -7
@@ -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