diff options
author | Jari Vetoniemi <mailroxas@gmail.com> | 2018-05-16 15:30:59 +0300 |
---|---|---|
committer | Jari Vetoniemi <mailroxas@gmail.com> | 2018-05-16 15:30:59 +0300 |
commit | 295ee1100b0bce881a00bdfbdb9492e2158d8a69 (patch) | |
tree | 7c00dbccd02d08b5e7ba86f8bfd4c351c77584e7 | |
parent | adbb23f33a4c30e828ffce7025b1035597ddc9f0 (diff) |
libc: Temporary hack for sigaction
For some reason doesn't work with NULL act, need to investigate more
later.
-rw-r--r-- | src/libc.c | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -163,16 +163,20 @@ bionic_readdir_r(DIR *dirp, struct bionic_dirent *entry, struct bionic_dirent ** int bionic_sigaction(int sig, const struct bionic_sigaction *restrict act, struct bionic_sigaction *restrict oact) { - assert(act); + verbose("%d, %p, %p", sig, act, oact); - struct sigaction goact, gact = { - .sa_handler = act->_u._sa_handler, - .sa_mask = act->sa_mask, - .sa_flags = act->sa_flags, - .sa_restorer = act->sa_restorer, - }; + if (!act) + return 0; + + struct sigaction goact = {0}, gact = {0}; + if (act) { + gact.sa_handler = act->_u._sa_handler; + gact.sa_mask = act->sa_mask; + gact.sa_flags = act->sa_flags; + gact.sa_restorer = act->sa_restorer; + } - const int ret = sigaction(sig, &gact, &goact); + const int ret = sigaction(sig, (act ? &gact : NULL), (oact ? &goact : NULL)); if (oact) { oact->_u._sa_handler = goact.sa_handler; |