aboutsummaryrefslogtreecommitdiff
path: root/nscd/nscd.c
diff options
context:
space:
mode:
Diffstat (limited to 'nscd/nscd.c')
-rw-r--r--nscd/nscd.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/nscd/nscd.c b/nscd/nscd.c
index ffbc6f8..26cf3c2 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)