X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fmount%2Fnetwork.c;h=565330281c940f94a5ab03bd7c945778934d1398;hp=21cf4efe72c646b2d26acca4ba038dde23962ca5;hb=897f581874255d363e00ef94534f6fced8dd2ba2;hpb=a3c8371b4f4cf9f0ff93ca040cac13dc4806ded9 diff --git a/utils/mount/network.c b/utils/mount/network.c index 21cf4ef..5653302 100644 --- a/utils/mount/network.c +++ b/utils/mount/network.c @@ -135,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: