toolkit/crashreporter/breakpad-patches/17-bug942407-usersig.patch
author Dan Minor <dminor@mozilla.com>
Thu, 10 Apr 2014 15:24:29 -0400
changeset 178551 b62c590540b0a0b82924413a0f2bcf0022cc8713
parent 162591 b196fffee8445be5d4485281ac4021805d925b01
permissions -rw-r--r--
Bug 994830 - Make cppunittest test timeout less than mozharness process timeout; r=ted

# HG changeset patch
# User Jed Davis <jld@mozilla.com>

Bug 942407: Fix breakpad signal handler's test for signal origin. r=ted


diff --git a/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.cc b/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.cc
index 55834e0..df958fb 100644
--- a/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.cc
+++ b/toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.cc
@@ -334,20 +334,20 @@ void ExceptionHandler::SignalHandler(int sig, siginfo_t* info, void* uc) {
   if (handled) {
     signal(sig, SIG_DFL);
   } else {
     RestoreHandlersLocked();
   }
 
   pthread_mutex_unlock(&handler_stack_mutex_);
 
-  if (info->si_pid) {
-    // This signal was triggered by somebody sending us the signal with kill().
-    // In order to retrigger it, we have to queue a new signal by calling
-    // kill() ourselves.
+  if (info->si_code <= 0) {
+    // This signal was sent by another process.  (Positive values of
+    // si_code are reserved for kernel-originated signals.)  In order
+    // to retrigger it, we have to queue a new signal.
     if (tgkill(getpid(), syscall(__NR_gettid), sig) < 0) {
       // If we failed to kill ourselves (e.g. because a sandbox disallows us
       // to do so), we instead resort to terminating our process. This will
       // result in an incorrect exit code.
       _exit(1);
     }
   } else {
     // This was a synchronous signal triggered by a hard fault (e.g. SIGSEGV).
-- 
1.8.4.rc3