diff options
author | Jeff Layton <jlayton@redhat.com> | 2010-02-12 14:35:31 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2010-02-12 14:35:31 -0500 |
commit | 33203b53ac5f43eef995c100299e45bd441c67d8 (patch) | |
tree | 6a6f8ef13690a0249ccddba8ae1b3c2372fd517f | |
parent | 1d4a0cb29ee88257b42d18a22388e1b23cf13bcc (diff) | |
download | nfs-utils-33203b53ac5f43eef995c100299e45bd441c67d8.tar.gz nfs-utils-33203b53ac5f43eef995c100299e45bd441c67d8.tar.xz nfs-utils-33203b53ac5f43eef995c100299e45bd441c67d8.zip |
mount.nfs: make nfs_{nfs,mount}_proto set errno on error
Have nfs_nfs_proto and nfs_mount_proto set errno to EPROTONOSUPPORT on
error. This helps default_value to display sane warning messages.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r-- | utils/mount/network.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/utils/mount/network.c b/utils/mount/network.c index a12fbe2..f020933 100644 --- a/utils/mount/network.c +++ b/utils/mount/network.c @@ -1273,7 +1273,8 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version) /* * Returns TRUE if @protocol contains a valid value for this option, - * or FALSE if the option was specified with an invalid value. + * or FALSE if the option was specified with an invalid value. On + * error, errno is set. */ int nfs_nfs_protocol(struct mount_options *options, unsigned long *protocol) @@ -1290,8 +1291,13 @@ nfs_nfs_protocol(struct mount_options *options, unsigned long *protocol) return 1; case 2: /* proto */ option = po_get(options, "proto"); - if (option != NULL) - return nfs_get_proto(option, &family, protocol); + if (option != NULL) { + if (!nfs_get_proto(option, &family, protocol)) { + errno = EPROTONOSUPPORT; + return 0; + } + return 1; + } } /* @@ -1449,7 +1455,8 @@ nfs_mount_version(struct mount_options *options, unsigned long *version) /* * Returns TRUE if @protocol contains a valid value for this option, - * or FALSE if the option was specified with an invalid value. + * or FALSE if the option was specified with an invalid value. On + * error, errno is set. */ static int nfs_mount_protocol(struct mount_options *options, unsigned long *protocol) @@ -1458,8 +1465,13 @@ nfs_mount_protocol(struct mount_options *options, unsigned long *protocol) char *option; option = po_get(options, "mountproto"); - if (option != NULL) - return nfs_get_proto(option, &family, protocol); + if (option != NULL) { + if (!nfs_get_proto(option, &family, protocol)) { + errno = EPROTONOSUPPORT; + return 0; + } + return 1; + } /* * MNT transport protocol wasn't specified. If the NFS |