Skip to contentSkip to conversation

mount.nfs: mounts fail when invalid versions are specified

PATCH New Steve Dickson 1 participant 1 message Sep 15, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mount.nfs: mounts fail when invalid versions are specified

When mount options like -o nfsvers=5 or -o v5 call the mount to silently fail. This patch adds verbosity to those types of failures.

---
 utils/mount/network.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
utils/mount/network.c +8 -0
index e7bd522..e125c11 100644
@@ -1235,6 +1235,10 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)
 	long tmp;
 
 	switch (po_rightmost(options, nfs_version_opttbl)) {
+	case -1: /* invalid value */
+		nfs_error(_("%s: invalid mount option was specified"),
+					progname);
+		return 0;
 	case 0:	/* v2 */
 		*version = 2;
 		return 1;
@@ -1251,6 +1255,8 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)
 				*version = tmp;
 				return 1;
 			}
+			nfs_error(_("%s: invalid value for 'vers=' option"),
+					progname);
 			return 0;
 		case PO_NOT_FOUND:
 			nfs_error(_("%s: parsing error on 'vers=' option\n"),
@@ -1268,6 +1274,8 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)
 				*version = tmp;
 				return 1;
 			}
+			nfs_error(_("%s: invalid value for 'nfsvers=' option"),
+					progname);
 			return 0;
 		case PO_NOT_FOUND:
 			nfs_error(_("%s: parsing error on 'nfsvers=' option\n"),
Signature · 1 line
1.7.6