aboutsummaryrefslogtreecommitdiff
path: root/nscd
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2013-01-10 10:42:49 +0100
committerAndreas Schwab <schwab@suse.de>2013-01-10 10:44:04 +0100
commitee32fdd79a24f53f459fa94443065a31bf55764f (patch)
treec7564e7f9e87a2be6392faa878bdc047248df2eb /nscd
parent7490eb81ae6b3d9e2c9784fd845e0fc2d5484292 (diff)
downloadglibc-ee32fdd79a24f53f459fa94443065a31bf55764f.tar
glibc-ee32fdd79a24f53f459fa94443065a31bf55764f.tar.gz
glibc-ee32fdd79a24f53f459fa94443065a31bf55764f.tar.bz2
glibc-ee32fdd79a24f53f459fa94443065a31bf55764f.zip
Revert "nscd: don't fork twice"
This reverts commit 7e9b080575fd68c788c33623594ba5516fa7ceb0.
Diffstat (limited to 'nscd')
-rw-r--r--nscd/nscd.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/nscd/nscd.c b/nscd/nscd.c
index ffbc6f8bc9..26cf3c2692 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -252,6 +252,15 @@ main (int argc, char **argv)
for (i = min_close_fd; i < getdtablesize (); i++)
close (i);
+ if (run_mode == RUN_DAEMONIZE)
+ {
+ pid = fork ();
+ if (pid == -1)
+ error (EXIT_FAILURE, errno, _("cannot fork"));
+ if (pid != 0)
+ exit (0);
+ }
+
setsid ();
if (chdir ("/") != 0)