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

Re: [PATCH 7/6] run-command: block signals between fork and execve

From: Eric Wong <hidden>
Date: 2017-04-14 05:35:12

Eric Wong [off-list ref] wrote:
Brandon Williams [off-list ref] wrote:
quoted
On 04/13, Eric Wong wrote:
quoted
@@ -277,6 +278,8 @@ static void child_err_spew(struct child_process *cmd, struct child_err *cerr)
 		error_errno("exec '%s': cd to '%s' failed",
 			    cmd->argv[0], cmd->dir);
 		break;
+	case CHILD_ERR_SIGPROCMASK:
+		error_errno("sigprocmask failed restoring signals");
missing a break statement here I'll add it in, in the re-roll.
Good catch, thanks!
Actually, I now wonder if that should be die_errno instead.
sigprocmask failures (EFAULT/EINVAL) would only be due
to programmer error.

In one of my minor projects(*), I do something like this:

# define CHECK(type, expect, expr) do { \
	type checkvar = (expr); \
	assert(checkvar == (expect) && "BUG" && __FILE__ && __LINE__); \
	} while (0)

	CHECK(int, 0, sigfillset(&fullset));
	CHECK(int, 0, sigemptyset(&emptyset));
	CHECK(int, 0, pthread_sigmask(SIG_SETMASK, &fullset, NULL));

Dunno if it's considered good style or not, here.

(*) git clone git://bogomips.org/cmogstored
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help