]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Preserve the sign of the bottom 16 bits of si_code when discarding
authorTom Hughes <tom@compton.nu>
Sun, 13 Nov 2005 11:52:39 +0000 (11:52 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 13 Nov 2005 11:52:39 +0000 (11:52 +0000)
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

coregrind/m_signals.c

index 9f340f4119903541acf47f4d48cbb42a4d9faf3c..f11269bee46f5d157cf11de3b790012c6db436df 100644 (file)
@@ -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) {