X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=support%2Fnfs%2Frpcmisc.c;h=dab2be8693e58c641e31232e6e1458508c1e348f;hp=aa23601d465e6a969bbec29cf48bbcf83c9e079e;hb=6e419afa493acc1c88fbc4d1a27bfb1784c1297a;hpb=b803949b6e3025f231e325562ec729a7080af435 diff --git a/support/nfs/rpcmisc.c b/support/nfs/rpcmisc.c index aa23601..dab2be8 100644 --- a/support/nfs/rpcmisc.c +++ b/support/nfs/rpcmisc.c @@ -37,7 +37,6 @@ #define socklen_t int #endif -static void closedown(int sig); static int makesock(int port, int proto); #define _RPCSVC_CLOSEDOWN 120 @@ -45,6 +44,31 @@ int _rpcpmstart = 0; int _rpcfdtype = 0; int _rpcsvcdirty = 0; +static void +closedown(int sig) +{ + (void) signal(sig, closedown); + + if (_rpcsvcdirty == 0) { + static int size; + int i, openfd; + + if (_rpcfdtype == SOCK_DGRAM) + exit(0); + + if (size == 0) + size = getdtablesize(); + + for (i = 0, openfd = 0; i < size && openfd < 2; i++) + if (FD_ISSET(i, &svc_fdset)) + openfd++; + if (openfd <= 1) + exit(0); + } + + (void) alarm(_RPCSVC_CLOSEDOWN); +} + void rpc_init(char *name, int prog, int vers, void (*dispatch)(struct svc_req *, register SVCXPRT *), @@ -139,28 +163,6 @@ rpc_init(char *name, int prog, int vers, } } -static void closedown(sig) -int sig; -{ - (void) signal(sig, closedown); - if (_rpcsvcdirty == 0) { - static int size; - int i, openfd; - - if (_rpcfdtype == SOCK_DGRAM) - exit(0); - if (size == 0) { - size = getdtablesize(); - } - for (i = 0, openfd = 0; i < size && openfd < 2; i++) - if (FD_ISSET(i, &svc_fdset)) - openfd++; - if (openfd <= 1) - exit(0); - } - (void) alarm(_RPCSVC_CLOSEDOWN); -} - /* * Create listener socket for a given port *