From: Tom Hughes Date: Sun, 13 Nov 2005 11:52:39 +0000 (+0000) Subject: Preserve the sign of the bottom 16 bits of si_code when discarding X-Git-Tag: svn/VALGRIND_3_1_0~118 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b828d84587d309d4e958f0c90ecb8a80b3e28bc6;p=thirdparty%2Fvalgrind.git Preserve the sign of the bottom 16 bits of si_code when discarding the top 16 bits - the pthread library uses negative code values in the signals it sends between threads. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5114 --- diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c index 9f340f4119..f11269bee4 100644 --- a/coregrind/m_signals.c +++ b/coregrind/m_signals.c @@ -1359,7 +1359,7 @@ void async_signalhandler ( Int sigNo, vki_siginfo_t *info, struct vki_ucontext * use and only exports the bottom 16 bits to user space - at least that is the theory, but it turns out that there are some kernels around that forget to mask out the top 16 bits so we do it here. */ - info->si_code &= 0xffff; + info->si_code = (Short)info->si_code; #endif /* The thread isn't currently running, make it so before going on */ @@ -1476,7 +1476,7 @@ void sync_signalhandler ( Int sigNo, vki_siginfo_t *info, struct vki_ucontext *u use and only exports the bottom 16 bits to user space - at least that is the theory, but it turns out that there are some kernels around that forget to mask out the top 16 bits so we do it here. */ - info->si_code &= 0xffff; + info->si_code = (Short)info->si_code; #endif if (info->si_code <= VKI_SI_USER) {