X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=utils%2Fmountd%2Fmountd.c;h=73f9f66c074d3328309920cc63affe24ed8103a4;hb=7f23a81a22248720b4dbc3cf7f15cc8812e9cfac;hp=b5779716148d33eaeb6ec6949e8660f6439aea55;hpb=8f4b4516cb37211057e775756b5701c4be050648;p=nfs-utils.git diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c index b577971..73f9f66 100644 --- a/utils/mountd/mountd.c +++ b/utils/mountd/mountd.c @@ -484,6 +484,13 @@ main(int argc, char **argv) /* WARNING: the following works on Linux and SysV, but not BSD! */ sigaction(SIGCHLD, &sa, NULL); + /* Daemons should close all extra filehandles ... *before* RPC init. */ + if (!foreground) { + int fd = sysconf (_SC_OPEN_MAX); + while (--fd > 2) + (void) close(fd); + } + if (nfs_version & 0x1) rpc_init("mountd", MOUNTPROG, MOUNTVERS, mount_dispatch, port);