patches/glibc/2.9/360-2.8-nscd-one-fork.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jan 17 23:06:02 2010 +0100 (2010-01-17)
changeset 1740 c57458bb354d
parent 1201 c9967a6e3b25
permissions -rw-r--r--
configure: do not require hg when configuring in an hg clone

When configuring in an hg clone, we need hg to compute the version string.
It can happen that users do not have Mercurial (eg. if they got a snapshot
rather that they did a full clone). In this case, we can still run, of
course, so simply fill the version string with a sufficiently explicit
value, that does not require hg. The date is a good candidate.
     1 Original patch from: gentoo/src/patchsets/glibc/2.9/1160_all_glibc-2.8-nscd-one-fork.patch
     2 
     3 -= BEGIN original header =-
     4 only fork one to assist in stop-start-daemon assumptions about daemon behavior
     5 
     6 http://bugs.gentoo.org/190785
     7 
     8 -= END original header =-
     9 
    10 diff -durN glibc-2_9.orig/nscd/nscd.c glibc-2_9/nscd/nscd.c
    11 --- glibc-2_9.orig/nscd/nscd.c	2008-03-29 19:08:12.000000000 +0100
    12 +++ glibc-2_9/nscd/nscd.c	2009-02-02 22:01:10.000000000 +0100
    13 @@ -179,6 +179,9 @@
    14        if (pid != 0)
    15  	exit (0);
    16  
    17 +       if (write_pid (_PATH_NSCDPID) < 0)
    18 +	dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
    19 +
    20        int nullfd = open (_PATH_DEVNULL, O_RDWR);
    21        if (nullfd != -1)
    22  	{
    23 @@ -228,12 +231,6 @@
    24  	for (i = min_close_fd; i < getdtablesize (); i++)
    25  	  close (i);
    26  
    27 -      pid = fork ();
    28 -      if (pid == -1)
    29 -	error (EXIT_FAILURE, errno, _("cannot fork"));
    30 -      if (pid != 0)
    31 -	exit (0);
    32 -
    33        setsid ();
    34  
    35        if (chdir ("/") != 0)
    36 @@ -242,9 +239,6 @@
    37  
    38        openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
    39  
    40 -      if (write_pid (_PATH_NSCDPID) < 0)
    41 -        dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
    42 -
    43        if (!init_logfile ())
    44  	dbg_log (_("Could not create log file"));
    45