aboutsummaryrefslogtreecommitdiff
path: root/nscd/nscd.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-07-24 12:58:36 +0000
committerUlrich Drepper <drepper@redhat.com>1998-07-24 12:58:36 +0000
commit6c202c68704b50016c4faba8d6445ab542b5f301 (patch)
treefb98ab84aee572c36755b83133187d96ab934164 /nscd/nscd.c
parentcc60175e8cecbedb4c555379c3c667c9cf9420fa (diff)
downloadglibc-6c202c68704b50016c4faba8d6445ab542b5f301.zip
glibc-6c202c68704b50016c4faba8d6445ab542b5f301.tar.gz
glibc-6c202c68704b50016c4faba8d6445ab542b5f301.tar.bz2
Update.
1998-07-24 Ulrich Drepper <drepper@cygnus.com> * sysdeps/generic/glob.c (glob): Fix problems with handle tilde. Reported by Brian Wellington <bwelling@anomaly.munge.com>. * elf/elf.h: Really define Elf64_Verdef, Elf64_Verdaux, Elf64_Verneed, and Elf64_Vernaux. 1998-07-24 Andreas Jaeger <aj@arthur.rhein-neckar.de> * configure.in: Recognize pgcc as compiler. Reported by sauron@angband.ee.ualberta.ca. 1998-07-02 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * nscd/dbg_log.c: Make sure, that debug message is really written. * nscd/nscd.c: Don't use daemon(), set signal handler after fork. SVID more for gamma(x) with x integer <= 0.
Diffstat (limited to 'nscd/nscd.c')
-rw-r--r--nscd/nscd.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/nscd/nscd.c b/nscd/nscd.c
index e1c6367..9ddbb5f 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -116,11 +116,6 @@ main (int argc, char **argv)
exit (EXIT_FAILURE);
}
- signal (SIGINT, termination_handler);
- signal (SIGQUIT, termination_handler);
- signal (SIGTERM, termination_handler);
- signal (SIGPIPE, SIG_IGN);
-
/* Check if we are already running. */
if (check_pid (_PATH_NSCDPID))
{
@@ -131,14 +126,21 @@ main (int argc, char **argv)
/* Behave like a daemon. */
if (go_background)
{
+ int i;
+
+ if (fork ())
+ exit (0);
+
+ for (i = 0; i < getdtablesize (); i++)
+ close (i);
+
+ if (fork ())
+ exit (0);
+
+ chdir ("/");
+
openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
- if (daemon (0, 0) < 0)
- {
- fprintf (stderr, _("connot auto-background: %s\n"),
- strerror (errno));
- exit (EXIT_FAILURE);
- }
if (write_pid (_PATH_NSCDPID) < 0)
dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno));
@@ -147,6 +149,12 @@ main (int argc, char **argv)
signal (SIGTTIN, SIG_IGN);
signal (SIGTSTP, SIG_IGN);
}
+
+ signal (SIGINT, termination_handler);
+ signal (SIGQUIT, termination_handler);
+ signal (SIGTERM, termination_handler);
+ signal (SIGPIPE, SIG_IGN);
+
/* Cleanup files created by a previous `bind' */
unlink (_PATH_NSCDSOCKET);