diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-03-02 22:27:32 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2017-03-06 09:56:35 +0000 |
commit | 37fd42459e98fe84234ecf65083fc75096a75b52 (patch) | |
tree | 06ee92c4a174e5f44025de249abbfd18e6e6c545 /src | |
parent | a1c27748d22f94d608cc499db527bf989a5516f2 (diff) |
forkfd: fix calling the old signal handler when there wasn't one
On some stupid systems, execve() may clear the handler but not clear
the SA_SIGINFO flag.
This change now requires that sa_handler and sa_sigaction be in a union
together. We can't operate otherwise.
Task-number: QTBUG-59246
Change-Id: I33850dcdb2ce4a47878efffd14a84b48a8f6b1e8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/3rdparty/forkfd/forkfd.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/3rdparty/forkfd/forkfd.c b/src/3rdparty/forkfd/forkfd.c index 309458a3a7..8113fdb9e7 100644 --- a/src/3rdparty/forkfd/forkfd.c +++ b/src/3rdparty/forkfd/forkfd.c @@ -297,10 +297,12 @@ static void sigchld_handler(int signum, siginfo_t *handler_info, void *handler_c * But we pass them anyway. Let's call the chained handler first, while * those two arguments have a chance of being correct. */ - if (old_sigaction.sa_flags & SA_SIGINFO) - old_sigaction.sa_sigaction(signum, handler_info, handler_context); - else if (old_sigaction.sa_handler != SIG_IGN && old_sigaction.sa_handler != SIG_DFL) - old_sigaction.sa_handler(signum); + if (old_sigaction.sa_handler != SIG_IGN && old_sigaction.sa_handler != SIG_DFL) { + if (old_sigaction.sa_flags & SA_SIGINFO) + old_sigaction.sa_sigaction(signum, handler_info, handler_context); + else + old_sigaction.sa_handler(signum); + } if (ffd_atomic_load(&forkfd_status, FFD_ATOMIC_RELAXED) == 1) { /* is this one of our children? */ |