git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Packham <judge.packham@gmail.com>
To: Jeremiah Mahler <jmmahler@gmail.com>,
	Johannes Sixt <j.sixt@viscovery.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2 2/2] connect.c: replace signal() with sigaction()
Date: Sat, 31 May 2014 22:39:39 +1200	[thread overview]
Message-ID: <5389B16B.6070004@gmail.com> (raw)
In-Reply-To: <1d11d5da7ebc3a6e0d4ab64802b601526c19113c.1401482787.git.jmmahler@gmail.com>

On 31/05/14 08:58, Jeremiah Mahler wrote:
> From signal(2) man page:
> 
>   The behavior of signal() varies across UNIX versions, and has also var‐
>   ied historically across different versions of Linux.   Avoid  its  use:
>   use sigaction(2) instead.
> 
> Replaced signal() with sigaction() in connect.c
> 
> Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
> ---
>  connect.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/connect.c b/connect.c
> index a983d06..b2a33c9 100644
> --- a/connect.c
> +++ b/connect.c
> @@ -665,11 +665,14 @@ struct child_process *git_connect(int fd[2], const char *url,
>  	enum protocol protocol;
>  	const char **arg;
>  	struct strbuf cmd = STRBUF_INIT;
> +	struct sigaction sa;
>  
>  	/* Without this we cannot rely on waitpid() to tell
>  	 * what happened to our children.
>  	 */
> -	signal(SIGCHLD, SIG_DFL);
> +	memset(&sa, 0, sizeof(sa));
> +	sa.sa_handler = SIG_DFL;
> +	sigaction(SIGCHLD, &sa, 0);

I think this got lost in the wash with v1 but
Documentation/CodingGuidelines says to use NULL here instead of 0.

>  
>  	protocol = parse_connect_url(url, &hostandport, &path);
>  	if (flags & CONNECT_DIAG_URL) {
> 

  parent reply	other threads:[~2014-05-31 10:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-30 20:58 [PATCH v2 0/2] replace signal() with sigaction() Jeremiah Mahler
2014-05-30 20:58 ` [PATCH v2 1/2] compat/mingw.c: expand MinGW support for sigaction Jeremiah Mahler
2014-05-30 20:58 ` [PATCH v2 2/2] connect.c: replace signal() with sigaction() Jeremiah Mahler
2014-05-30 21:48   ` Andreas Schwab
2014-05-31 10:39   ` Chris Packham [this message]
2014-05-31 14:45     ` Jeremiah Mahler

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=5389B16B.6070004@gmail.com \
    --to=judge.packham@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=j.sixt@viscovery.net \
    --cc=jmmahler@gmail.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).