Re: [PATCH] Set SA_RESTART flag on SIGCHLD handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Anders Kaseorg wrote:
> On Sun, 18 Mar 2012, Jonathan Nieder wrote:

>> --- i/src/trap.c
>> +++ w/src/trap.c
>> @@ -259,7 +259,7 @@ setsignal(int signo)
>>  		act.sa_handler = SIG_DFL;
>>  	}
>>  	*t = action;
>> -	act.sa_flags = 0;
>> +	act.sa_flags = SA_RESTART;
>>  	sigfillset(&act.sa_mask);
>>  	sigaction(signo, &act, 0);
>>  }
[...]
> It looks like this was never forwarded to the dash mailing list.  Any 
> thoughts from upstream?
>
> Context: http://thread.gmane.org/gmane.comp.version-control.git.debian/147
> (FTR, it did happen again.)

Thanks.  Here's a less invasive patch to experiment with.

POSIX (XCU §2.11 "Signals and Error Handling") requires that the "wait"
utility must return immediately when interrupted by a trapped signal,
so SA_RESTART is not appropriate for those.  It does not seem to give
any advice on whether signals interrupt redirection.

diff --git i/src/redir.c w/src/redir.c
index f96a76bc..7fb7748f 100644
--- i/src/redir.c
+++ w/src/redir.c
@@ -206,8 +206,11 @@ openredirect(union node *redir)
 		/* FALLTHROUGH */
 	case NCLOBBER:
 		fname = redir->nfile.expfname;
-		if ((f = open64(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0)
+		while ((f = open64(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) {
+			if (errno == EINTR)
+				continue;
 			goto ecreate;
+		}
 		break;
 	case NAPPEND:
 		fname = redir->nfile.expfname;
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux