]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
2001-10-11 Chip Salzenberg <chip@pobox.com>
authorchip <chip>
Thu, 11 Oct 2001 20:11:44 +0000 (20:11 +0000)
committerchip <chip>
Thu, 11 Oct 2001 20:11:44 +0000 (20:11 +0000)
* utils/mountd/mountd.c (main): Close fds > 2 _before_ RPC init.
* debian/changelog: Version 0.3.3-2.

ChangeLog
debian/changelog
utils/mountd/mountd.c

index 55e2a3024796bcdaea9894732d7c63ef420daae9..36a16635ed4c821a85e90f03fe1dfaaa0bc97c97 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-10-11  Chip Salzenberg  <chip@pobox.com>
+
+       * utils/mountd/mountd.c (main): Close fds > 2 _before_ RPC init.
+       * debian/changelog: Version 0.3.3-2.
+
 2001-10-08  Chip Salzenberg  <chip@pobox.com>
 
        * utils/mountd/mountd.c (main): When daemonizing, close all fds > 2.
index a5f88e3ffd795b68c89723ea82dc779d566f4e19..954aff783ad1e884bf98e85251d85687d5045efb 100644 (file)
@@ -1,3 +1,10 @@
+nfs-utils (1:0.3.3-2) unstable; urgency=high
+
+  * The "Test It Before Release, Stupid" release.
+  * Repair total failure of rpc.mountd.  (closes: #115095)
+
+ -- Chip Salzenberg <chip@valinux.com>  Thu, 11 Oct 2001 13:03:45 -0700
+
 nfs-utils (1:0.3.3-1) unstable; urgency=medium
 
   * The "Life Goes On" release.
index e93f0ba73121d017946697accf2cb98d6d4165be..73f9f66c074d3328309920cc63affe24ed8103a4 100644 (file)
@@ -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);
@@ -512,17 +519,11 @@ main(int argc, char **argv)
                /* Now we remove ourselves from the foreground.
                   Redirect stdin/stdout/stderr first. */
                {
-                       int fd, fdmax;
-
-                       fd = open("/dev/null", O_RDWR);
+                       int fd = open("/dev/null", O_RDWR);
                        (void) dup2(fd, 0);
                        (void) dup2(fd, 1);
                        (void) dup2(fd, 2);
-
-                       fdmax = sysconf (_SC_OPEN_MAX);
-                       for (fd = 3; fd < fdmax; fd++) {
-                               close (fd);
-                       }
+                       if (fd > 2) (void) close(fd);
                }
                setsid();
                xlog_background();