From: Jeremiah Mahler Date: Wed, 28 May 2014 06:14:15 GMT Subject: [PATCH 5/5] connect.c: replace signal() with sigaction() Message-ID: <1401257655-6043-6-git-send-email-jmmahler@gmail.com> In-Reply-To: <1401257655-6043-1-git-send-email-jmmahler@gmail.com> From signal(2) 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. See Portability below. Replaced signal() with sigaction() in connect.c Signed-off-by: Jeremiah Mahler --- 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); protocol = parse_connect_url(url, &hostandport, &path); if (flags & CONNECT_DIAG_URL) { -- 2.0.0.rc4.6.g127602c