linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@redhat.com>
To: Scott Mayhew <smayhew@redhat.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [nfs-utils PATCH] close the syslog fd in daemon_init()
Date: Wed, 4 Nov 2015 16:49:28 -0500	[thread overview]
Message-ID: <563A7D68.3080707@RedHat.com> (raw)
In-Reply-To: <1443540985-27992-1-git-send-email-smayhew@redhat.com>



On 09/29/2015 11:36 AM, Scott Mayhew wrote:
> Commit 7addf9d (cleanup daemonization code) added the following line to
> mydaemon_init():
> 
>         dup2(pipefds[1], 3);
> 
> If we've already called vsyslog() before the fork(), then chances are fd
> 3 was being used for the syslog socket.  In that case the next vsyslog()
> call will cause the data to appear on the read end of the pipe, causing
> the parent to exit with a nonzero status.  If systemd is running, it
> will see the parent's nonzero exit status and will terminate the child
> as well.
> 
> So just call closelog() to close the fd.  The next call to vsyslog()
> will open a new one if need be.
> 
> Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Committed... Actual this is the one I fixed the warning on... 

steved.

> ---
>  support/nfs/mydaemon.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/support/nfs/mydaemon.c b/support/nfs/mydaemon.c
> index 3391eff..701cfd9 100644
> --- a/support/nfs/mydaemon.c
> +++ b/support/nfs/mydaemon.c
> @@ -122,6 +122,7 @@ daemon_init(bool fg)
>  	dup2(tempfd, 0);
>  	dup2(tempfd, 1);
>  	dup2(tempfd, 2);
> +	closelog();
>  	dup2(pipefds[1], 3);
>  	pipefds[1] = 3;
>  	closeall(4);
> 

      reply	other threads:[~2015-11-04 21:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-29 15:36 [nfs-utils PATCH] close the syslog fd in daemon_init() Scott Mayhew
2015-11-04 21:49 ` Steve Dickson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=563A7D68.3080707@RedHat.com \
    --to=steved@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=smayhew@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).