Lines 178-183
Link Here
|
178 |
if (pid != 0) |
178 |
if (pid != 0) |
179 |
exit (0); |
179 |
exit (0); |
180 |
|
180 |
|
|
|
181 |
if (write_pid (_PATH_NSCDPID) < 0) |
182 |
dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno)); |
183 |
|
181 |
int nullfd = open (_PATH_DEVNULL, O_RDWR); |
184 |
int nullfd = open (_PATH_DEVNULL, O_RDWR); |
182 |
if (nullfd != -1) |
185 |
if (nullfd != -1) |
183 |
{ |
186 |
{ |
Lines 227-238
Link Here
|
227 |
for (i = min_close_fd; i < getdtablesize (); i++) |
230 |
for (i = min_close_fd; i < getdtablesize (); i++) |
228 |
close (i); |
231 |
close (i); |
229 |
|
232 |
|
230 |
pid = fork (); |
|
|
231 |
if (pid == -1) |
232 |
error (EXIT_FAILURE, errno, _("cannot fork")); |
233 |
if (pid != 0) |
234 |
exit (0); |
235 |
|
236 |
setsid (); |
233 |
setsid (); |
237 |
|
234 |
|
238 |
if (chdir ("/") != 0) |
235 |
if (chdir ("/") != 0) |
Lines 241-249
Link Here
|
241 |
|
238 |
|
242 |
openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON); |
239 |
openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON); |
243 |
|
240 |
|
244 |
if (write_pid (_PATH_NSCDPID) < 0) |
|
|
245 |
dbg_log ("%s: %s", _PATH_NSCDPID, strerror (errno)); |
246 |
|
247 |
if (!init_logfile ()) |
241 |
if (!init_logfile ()) |
248 |
dbg_log (_("Could not create log file")); |
242 |
dbg_log (_("Could not create log file")); |