diff options
author | Dmitriy Ivanov <dimitry@google.com> | 2015-01-06 14:55:26 -0800 |
---|---|---|
committer | Dmitriy Ivanov <dimitry@google.com> | 2015-01-06 15:42:15 -0800 |
commit | c01683bea012d2ee15e325fac7177b920f23fea1 (patch) | |
tree | 7cb2063f05a857a18e9ff0b7ffed7f741270cfff /sigchainlib | |
parent | 55edd8e2982e21c4f3475bb8389c169830220c80 (diff) | |
download | art-c01683bea012d2ee15e325fac7177b920f23fea1.zip art-c01683bea012d2ee15e325fac7177b920f23fea1.tar.gz art-c01683bea012d2ee15e325fac7177b920f23fea1.tar.bz2 |
Fix sigchainlib's implementation of sigaction
Correctly handles the case when old_action == new_action
Bug: 18740478
Change-Id: I97092318439e4f6f0a2513d4336496c72f8c5599
(cherry picked from commit 797a29b334f2d311135602bf5204ae8b890f4a14)
Diffstat (limited to 'sigchainlib')
-rw-r--r-- | sigchainlib/sigchain.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sigchainlib/sigchain.cc b/sigchainlib/sigchain.cc index 601e321..2eb518c 100644 --- a/sigchainlib/sigchain.cc +++ b/sigchainlib/sigchain.cc @@ -170,12 +170,13 @@ extern "C" int sigaction(int signal, const struct sigaction* new_action, struct // Note that we check that the signal number is in range here. An out of range signal // number should behave exactly as the libc sigaction. if (signal > 0 && signal < _NSIG && user_sigactions[signal].IsClaimed()) { - if (old_action != NULL) { - *old_action = user_sigactions[signal].GetAction(); - } + struct sigaction saved_action = user_sigactions[signal].GetAction(); if (new_action != NULL) { user_sigactions[signal].SetAction(*new_action, false); } + if (old_action != NULL) { + *old_action = saved_action; + } return 0; } |