提交 118ebe4b 编写于 作者: L lnlan

fix: sigaction当前的sa_mask的设置方法,不符合该接口该字段的设置本意

【背景】
sigaction参数sa_mask的设置方法不符合设置本意,某种情况下会导致进程屏蔽字被覆盖
【修改方案】
修改设置方法,在handle处理前设置屏蔽字,处理后恢复屏蔽字

【影响】
如果用户在handle中设置了屏蔽字,该屏蔽字会在handle结束时会被覆盖掉。已测试了所有
相关用例,均可通过。待在linux验证确认是问题后修复。

re #I3QQA9
Signed-off-by: Nlnlanc <lanleinan@163.com>

Change-Id: Ibc55b1c8720463c8ff68c22fbcb376d8d15bc1e4
上级 b17cf305
......@@ -173,29 +173,26 @@ static int __sig_cannot_catche(int sig, sa_sighandler_t handler)
static void __sig_operation(unsigned int receivedSigno)
{
int i;
sigset_t mask, oldmask;
sigemptyset(&mask);
sigemptyset(&oldmask);
for (i = 0; i < sizeof(sig_default_action) / sizeof(struct sig_default_act); i++) {
if (!g_sig_arr[i].ign_flag && g_sig_arr[i].signo == receivedSigno && g_sig_arr[i].act.sa_handler) {
sigaddset(&mask, receivedSigno);
sigprocmask(SIG_BLOCK, &mask, &oldmask);
sigprocmask(SIG_BLOCK, &g_sig_arr[i].act.sa_mask, NULL);
(*g_sig_arr[i].act.sa_handler)(g_sig_arr[i].signo);
sigprocmask(SIG_SETMASK, &oldmask, NULL);
return;
}
}
}
void arm_signal_process(unsigned int receivedSig)
{
sigset_t mask, oldmask;
sigemptyset(&mask);
sigemptyset(&oldmask);
sigaddset(&mask, receivedSig);
sigprocmask(SIG_BLOCK, &mask, NULL);
__sig_operation(receivedSig);
sigprocmask(SIG_BLOCK, NULL, &oldmask);
sigdelset(&oldmask, receivedSig);
sigprocmask(SIG_SETMASK, &oldmask, NULL);
}
static void __sig_add_def_action()
......@@ -267,7 +264,7 @@ static int __sig_action_opr(int sig, const sigaction_t *act, sigaction_t *oact)
sigact->act.sa_mask = act->sa_mask;
sigact->act.sa_flags = act->sa_flags;
}
sigprocmask(SIG_BLOCK, &act->sa_mask, NULL);
pthread_spin_unlock(&sig_lite_lock);
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册