Commit d3d89ae7 authored by Russ Cox's avatar Russ Cox

runtime: check rt_sigaction return values on linux

(If the mask size is wrong the system call fails.)

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7305097
parent 2b9787c2
......@@ -128,7 +128,8 @@ runtime·setsig(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart)
// under nohup and do not set explicit handler.
if(i == SIGHUP) {
runtime·memclr((byte*)&sa, sizeof sa);
runtime·rt_sigaction(i, nil, &sa, sizeof(sa.sa_mask));
if(runtime·rt_sigaction(i, nil, &sa, sizeof(sa.sa_mask)) != 0)
runtime·throw("rt_sigaction read failure");
if(sa.k_sa_handler == SIG_IGN)
return;
}
......
......@@ -144,7 +144,8 @@ runtime·setsig(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart)
// under nohup and do not set explicit handler.
if(i == SIGHUP) {
runtime·memclr((byte*)&sa, sizeof sa);
runtime·rt_sigaction(i, nil, &sa, sizeof(sa.sa_mask));
if(runtime·rt_sigaction(i, nil, &sa, sizeof(sa.sa_mask)) != 0)
runtime·throw("rt_sigaction read failure");
if(sa.sa_handler == SIG_IGN)
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment