patches/glibc/ports-2.13/300-nscd-one-fork.patch
changeset 2438 2ba5655f6297
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/glibc/ports-2.13/300-nscd-one-fork.patch	Tue May 03 00:19:56 2011 +0200
     1.3 @@ -0,0 +1,40 @@
     1.4 +only fork one to assist in stop-start-daemon assumptions about daemon behavior
     1.5 +
     1.6 +http://bugs.gentoo.org/190785
     1.7 +
     1.8 +diff -durN glibc-2.13.orig/nscd/nscd.c glibc-2.13/nscd/nscd.c
     1.9 +--- glibc-2.13.orig/nscd/nscd.c	2009-02-06 21:10:27.000000000 +0100
    1.10 ++++ glibc-2.13/nscd/nscd.c	2009-11-13 00:50:24.000000000 +0100
    1.11 +@@ -182,6 +182,9 @@
    1.12 +       if (pid != 0)
    1.13 + 	exit (0);
    1.14 + 
    1.15 ++       if (write_pid (_PATH_NSCDPID) < 0)
    1.16 ++	dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
    1.17 ++
    1.18 +       int nullfd = open (_PATH_DEVNULL, O_RDWR);
    1.19 +       if (nullfd != -1)
    1.20 + 	{
    1.21 +@@ -231,12 +234,6 @@
    1.22 + 	for (i = min_close_fd; i < getdtablesize (); i++)
    1.23 + 	  close (i);
    1.24 + 
    1.25 +-      pid = fork ();
    1.26 +-      if (pid == -1)
    1.27 +-	error (EXIT_FAILURE, errno, _("cannot fork"));
    1.28 +-      if (pid != 0)
    1.29 +-	exit (0);
    1.30 +-
    1.31 +       setsid ();
    1.32 + 
    1.33 +       if (chdir ("/") != 0)
    1.34 +@@ -245,9 +242,6 @@
    1.35 + 
    1.36 +       openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
    1.37 + 
    1.38 +-      if (write_pid (_PATH_NSCDPID) < 0)
    1.39 +-	dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
    1.40 +-
    1.41 +       if (!init_logfile ())
    1.42 + 	dbg_log (_("Could not create log file"));
    1.43 +