X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=support%2Fnfs%2Frpcmisc.c;h=22ea62c1a88f5d8458968c4fe82cf88dc802025a;hp=1c02364cecb153e6f33886b3b40499d97268d4ea;hb=2bb403d1547790e731e5b151f9ef41880a6eb6c7;hpb=e36b61ba46d34841a6ad99857c7cc43fc8c1ee89 diff --git a/support/nfs/rpcmisc.c b/support/nfs/rpcmisc.c index 1c02364..22ea62c 100644 --- a/support/nfs/rpcmisc.c +++ b/support/nfs/rpcmisc.c @@ -12,7 +12,9 @@ * as is, with no warranty expressed or implied. */ -#include "config.h" +#ifdef HAVE_CONFIG_H +#include +#endif #include #include @@ -32,6 +34,10 @@ #include #include "nfslib.h" +#if SIZEOF_SOCKLEN_T - 0 == 0 +#define socklen_t int +#endif + static void closedown(int sig); int makesock(int port, int proto); @@ -46,13 +52,13 @@ rpc_init(char *name, int prog, int vers, void (*dispatch)(), int defport) struct sockaddr_in saddr; SVCXPRT *transp; int sock; - int asize; + socklen_t asize; asize = sizeof(saddr); sock = 0; if (getsockname(0, (struct sockaddr *) &saddr, &asize) == 0 && saddr.sin_family == AF_INET) { - int ssize = sizeof (int); + socklen_t ssize = sizeof (int); int fdtype = 0; if (getsockopt(0, SOL_SOCKET, SO_TYPE, (char *)&fdtype, &ssize) == -1) @@ -178,8 +184,11 @@ int makesock(int port, int proto) sin.sin_port = htons(port); val = 1; - if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) < 0) - xlog(L_ERROR, "setsockopt failed: %s\n", strerror(errno)); + if (proto == IPPROTO_TCP) + if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, + &val, sizeof(val)) < 0) + xlog(L_ERROR, "setsockopt failed: %s\n", + strerror(errno)); #if 0 /* I was told it didn't work with gigabit ethernet. @@ -226,10 +235,12 @@ rpc_logcall(struct svc_req *rqstp, char *xname, char *arg) break; case AUTH_UNIX: { struct authunix_parms *unix_cred; + time_t time; struct tm *tm; unix_cred = (struct authunix_parms *) rqstp->rq_clntcred; - tm = localtime(&unix_cred->aup_time); + time = unix_cred->aup_time; + tm = localtime(&time); snprintf(sp, buflen, "UNIX %d/%d/%d %02d:%02d:%02d %s %d.%d", tm->tm_year, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,