Thread (129 messages) 129 messages, 7 authors, 2017-04-25

Re: [PATCH v3 10/10] run-command: block signals between fork and execve

From: Eric Wong <hidden>
Date: 2017-04-14 21:35:44

Brandon Williams [off-list ref] wrote:
On 04/14, Brandon Williams wrote:
quoted
 		/*
+		 * restore default signal handlers here, in case
+		 * we catch a signal right before execve below
+		 */
+		for (sig = 1; sig < NSIG; sig++) {
+			sighandler_t old = signal(sig, SIG_DFL);
So sighandler_t doesn't work on macOS.  Is there a more portable lib
that needs to be included for this to work?
Oops, maybe this works (only tested on GNU/Linux):
--- a/run-command.c
+++ b/run-command.c
@@ -675,7 +675,7 @@ int start_command(struct child_process *cmd)
 		 * we catch a signal right before execve below
 		 */
 		for (sig = 1; sig < NSIG; sig++) {
-			sighandler_t old = signal(sig, SIG_DFL);
+			void (*old)(int) = signal(sig, SIG_DFL);
 
 			/* ignored signals get reset to SIG_DFL on execve */
 			if (old == SIG_IGN)
Otherwise, maybe just casting to 'void *' is OK:

			void *old = (void *)signal(sig, SIG_DFL);

			if (old == (void *)SIG_IGN)
				...



void *old = signal(sig, SIG_DFL);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help