patches/glibc/2.9/360-2.8-nscd-one-fork.patch
branchnewlib
changeset 1365 c4d124ed9f8e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/glibc/2.9/360-2.8-nscd-one-fork.patch	Sun Apr 19 16:17:11 2009 +0000
     1.3 @@ -0,0 +1,45 @@
     1.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/1160_all_glibc-2.8-nscd-one-fork.patch
     1.5 +
     1.6 +-= BEGIN original header =-
     1.7 +only fork one to assist in stop-start-daemon assumptions about daemon behavior
     1.8 +
     1.9 +http://bugs.gentoo.org/190785
    1.10 +
    1.11 +-= END original header =-
    1.12 +
    1.13 +diff -durN glibc-2_9.orig/nscd/nscd.c glibc-2_9/nscd/nscd.c
    1.14 +--- glibc-2_9.orig/nscd/nscd.c	2008-03-29 19:08:12.000000000 +0100
    1.15 ++++ glibc-2_9/nscd/nscd.c	2009-02-02 22:01:10.000000000 +0100
    1.16 +@@ -179,6 +179,9 @@
    1.17 +       if (pid != 0)
    1.18 + 	exit (0);
    1.19 + 
    1.20 ++       if (write_pid (_PATH_NSCDPID) < 0)
    1.21 ++	dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
    1.22 ++
    1.23 +       int nullfd = open (_PATH_DEVNULL, O_RDWR);
    1.24 +       if (nullfd != -1)
    1.25 + 	{
    1.26 +@@ -228,12 +231,6 @@
    1.27 + 	for (i = min_close_fd; i < getdtablesize (); i++)
    1.28 + 	  close (i);
    1.29 + 
    1.30 +-      pid = fork ();
    1.31 +-      if (pid == -1)
    1.32 +-	error (EXIT_FAILURE, errno, _("cannot fork"));
    1.33 +-      if (pid != 0)
    1.34 +-	exit (0);
    1.35 +-
    1.36 +       setsid ();
    1.37 + 
    1.38 +       if (chdir ("/") != 0)
    1.39 +@@ -242,9 +239,6 @@
    1.40 + 
    1.41 +       openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
    1.42 + 
    1.43 +-      if (write_pid (_PATH_NSCDPID) < 0)
    1.44 +-        dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
    1.45 +-
    1.46 +       if (!init_logfile ())
    1.47 + 	dbg_log (_("Could not create log file"));
    1.48 +