X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fmount%2Fnetwork.c;h=8dc183a16e78983ef8fcf8f79506275b1c635763;hp=a12fbe23ef9f779f29fc03f30abf2fc48be40332;hb=bc7736ea87166e99d6b4f57da84d26d007db8ae4;hpb=1d4a0cb29ee88257b42d18a22388e1b23cf13bcc diff --git a/utils/mount/network.c b/utils/mount/network.c index a12fbe2..8dc183a 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; + } } /* @@ -1367,8 +1373,9 @@ int nfs_nfs_proto_family(struct mount_options *options, switch (po_rightmost(options, nfs_transport_opttbl)) { case 0: /* udp */ - return 1; case 1: /* tcp */ + /* for compatibility; these are always AF_INET */ + *family = AF_INET; return 1; case 2: /* proto */ option = po_get(options, "proto"); @@ -1449,7 +1456,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 +1466,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