summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--utils/mount/network.c15
-rw-r--r--utils/mount/parse_opt.c7
-rw-r--r--utils/mount/parse_opt.h2
-rw-r--r--utils/mount/stropts.c4
4 files changed, 14 insertions, 14 deletions
diff --git a/utils/mount/network.c b/utils/mount/network.c
index 91a005c..a974953 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -1168,16 +1168,16 @@ static rpcvers_t nfs_nfs_version(struct mount_options *options)
long tmp;
switch (po_rightmost(options, nfs_version_opttbl)) {
- case 1: /* v2 */
+ case 0: /* v2 */
return 2;
- case 2: /* v3 */
+ case 1: /* v3 */
return 3;
- case 3: /* vers */
+ case 2: /* vers */
if (po_get_numeric(options, "vers", &tmp) == PO_FOUND)
if (tmp >= 2 && tmp <= 3)
return tmp;
break;
- case 4: /* nfsvers */
+ case 3: /* nfsvers */
if (po_get_numeric(options, "nfsvers", &tmp) == PO_FOUND)
if (tmp >= 2 && tmp <= 3)
return tmp;
@@ -1198,11 +1198,9 @@ static unsigned short nfs_nfs_protocol(struct mount_options *options)
char *option;
switch (po_rightmost(options, nfs_transport_opttbl)) {
- case 1: /* udp */
- return IPPROTO_UDP;
- case 2: /* tcp */
+ case 1: /* tcp */
return IPPROTO_TCP;
- case 3: /* proto */
+ case 2: /* proto */
option = po_get(options, "proto");
if (option) {
if (strcmp(option, "tcp") == 0)
@@ -1211,6 +1209,7 @@ static unsigned short nfs_nfs_protocol(struct mount_options *options)
return IPPROTO_UDP;
}
}
+
return IPPROTO_UDP;
}
diff --git a/utils/mount/parse_opt.c b/utils/mount/parse_opt.c
index 4934508..1dfee8a 100644
--- a/utils/mount/parse_opt.c
+++ b/utils/mount/parse_opt.c
@@ -437,9 +437,10 @@ po_found_t po_get_numeric(struct mount_options *options, char *keyword, long *va
* as "proto=," "udp" and "tcp."
*
* Returns the index into @keys of the option that is rightmost.
- * If none of the options are present, returns zero.
+ * If none of the options listed in @keys is present in @options, or
+ * if @options is NULL, returns -1.
*/
-unsigned int po_rightmost(struct mount_options *options, const char *keys[])
+int po_rightmost(struct mount_options *options, const char *keys[])
{
struct mount_option *option;
unsigned int i;
@@ -452,7 +453,7 @@ unsigned int po_rightmost(struct mount_options *options, const char *keys[])
}
}
- return 0;
+ return -1;
}
/**
diff --git a/utils/mount/parse_opt.h b/utils/mount/parse_opt.h
index e132b1c..f9243c3 100644
--- a/utils/mount/parse_opt.h
+++ b/utils/mount/parse_opt.h
@@ -47,7 +47,7 @@ po_found_t po_contains(struct mount_options *, char *);
char * po_get(struct mount_options *, char *);
po_found_t po_get_numeric(struct mount_options *,
char *, long *);
-unsigned int po_rightmost(struct mount_options *,
+int po_rightmost(struct mount_options *,
const char *keys[]);
po_found_t po_remove_all(struct mount_options *, char *);
void po_destroy(struct mount_options *);
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index 6d44bb7..770b5b5 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -232,7 +232,7 @@ static const char *nfs_lock_opttbl[] = {
static int nfs_verify_lock_option(struct mount_options *options)
{
- if (po_rightmost(options, nfs_lock_opttbl) == 1)
+ if (po_rightmost(options, nfs_lock_opttbl) == 0)
return 1;
if (!start_statd()) {
@@ -756,7 +756,7 @@ static int nfsmount_start(struct nfsmount_info *mi)
if (!nfs_validate_options(mi))
return EX_FAIL;
- if (po_rightmost(mi->options, nfs_background_opttbl) == 1)
+ if (po_rightmost(mi->options, nfs_background_opttbl) == 0)
return nfsmount_bg(mi);
else
return nfsmount_fg(mi);