This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] nscd: don't fork twice
- From: Carlos O'Donell <carlos at systemhalted dot org>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 14 Jan 2013 09:35:30 -0500
- Subject: Re: [PATCH] nscd: don't fork twice
- References: <mvmy5fwavdv.fsf@hawking.suse.de>
On 01/14/2013 05:53 AM, Andreas Schwab wrote:
> There is no need to fork twice when daemonizing.
>
> Andreas.
>
> * nscd/nscd.c (main): Don't fork again after closing files.
>
> diff --git a/nscd/nscd.c b/nscd/nscd.c
> index 26cf3c2..ffbc6f8 100644
> --- a/nscd/nscd.c
> +++ b/nscd/nscd.c
> @@ -252,15 +252,6 @@ 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)
>
Looks good to me.
I'm a little confused though, and I haven't checked exactly what's
going on, but it looks like you reverted a bunch of patches and are
sending them out for review. What's the story there?
Cheers,
Carlos.