X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=utils%2Fmount%2Fnetwork.c;h=565330281c940f94a5ab03bd7c945778934d1398;hb=897f581874255d363e00ef94534f6fced8dd2ba2;hp=12fc7620877b11eb6d8e84e042302a445b42f465;hpb=4a986ff4663413c29ceee4b8b9355ea4bc169d71;p=nfs-utils.git diff --git a/utils/mount/network.c b/utils/mount/network.c index 12fc762..5653302 100644 --- a/utils/mount/network.c +++ b/utils/mount/network.c @@ -38,7 +38,6 @@ #include "xcommon.h" #include "mount.h" #include "nls.h" -#include "nfsumount.h" #include "nfs_mount.h" #include "mount_constants.h" #include "network.h" @@ -136,8 +135,23 @@ unsigned short getport(struct sockaddr_in *saddr, unsigned long prog, struct pmap parms; enum clnt_stat stat; - saddr->sin_port = htons (PMAPPORT); - socket = get_socket(saddr, prot, FALSE, FALSE); + saddr->sin_port = htons(PMAPPORT); + + /* + * Try to get a socket with a non-privileged port. + * clnt*create() will create one anyway if this + * fails. + */ + socket = get_socket(saddr, proto, FALSE, FALSE); + if (socket == RPC_ANYSOCK) { + if (proto == IPPROTO_TCP && errno == ETIMEDOUT) { + /* + * TCP SYN timed out, so exit now. + */ + rpc_createerr.cf_stat = RPC_TIMEDOUT; + } + return 0; + } switch (prot) { case IPPROTO_UDP: