Bug 1110499 - Don't exit crash handler on Android until we've finished started the reporter. r=ted, r=blassey, a=lmandel
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -47,18 +47,20 @@
#include "mac_utils.h"
#elif defined(XP_LINUX)
#include "nsIINIParser.h"
#include "common/linux/linux_libc_support.h"
#include "third_party/lss/linux_syscall_support.h"
#include "client/linux/crash_generation/client_info.h"
#include "client/linux/crash_generation/crash_generation_server.h"
#include "client/linux/handler/exception_handler.h"
+#include "common/linux/eintr_wrapper.h"
#include <fcntl.h>
#include <sys/types.h>
+#include <sys/wait.h>
#include <unistd.h>
#elif defined(XP_SOLARIS)
#include "client/solaris/handler/exception_handler.h"
#include <fcntl.h>
#include <sys/types.h>
#include <unistd.h>
#else
#error "Not yet implemented for this platform"
@@ -936,16 +938,23 @@ bool MinidumpCallback(
"start",
"-a", "org.mozilla.gecko.reportCrash",
"-n", crashReporterPath,
"--es", "minidumpPath", minidumpPath,
(char*)0);
}
#endif
_exit(1);
+#ifdef MOZ_WIDGET_ANDROID
+ } else {
+ // We need to wait on the 'am start' command above to finish, otherwise everything will
+ // be killed by the ActivityManager as soon as the signal handler exits
+ int status;
+ unused << HANDLE_EINTR(sys_waitpid(pid, &status, __WALL));
+#endif
}
#endif // XP_MACOSX
#endif // XP_UNIX
return returnValue;
}
#ifdef XP_WIN