mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2025-03-01 18:18:10 +00:00
Avoid setting an alternative stack for signals if there is already one
P=Mike Hommey <mh@glandium.org> R=ted at http://codereview.appspot.com/5573054/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@918 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
199703cbff
commit
87063908ad
|
@ -187,14 +187,18 @@ bool ExceptionHandler::InstallHandlers() {
|
||||||
// such a small stack.
|
// such a small stack.
|
||||||
static const unsigned kSigStackSize = 8192;
|
static const unsigned kSigStackSize = 8192;
|
||||||
|
|
||||||
signal_stack = malloc(kSigStackSize);
|
|
||||||
stack_t stack;
|
stack_t stack;
|
||||||
memset(&stack, 0, sizeof(stack));
|
// Only set an alternative stack if there isn't already one, or if the current
|
||||||
stack.ss_sp = signal_stack;
|
// one is too small.
|
||||||
stack.ss_size = kSigStackSize;
|
if (sys_sigaltstack(NULL, &stack) == -1 || !stack.ss_sp ||
|
||||||
|
stack.ss_size < kSigStackSize) {
|
||||||
|
memset(&stack, 0, sizeof(stack));
|
||||||
|
stack.ss_sp = malloc(kSigStackSize);
|
||||||
|
stack.ss_size = kSigStackSize;
|
||||||
|
|
||||||
if (sys_sigaltstack(&stack, NULL) == -1)
|
if (sys_sigaltstack(&stack, NULL) == -1)
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
memset(&sa, 0, sizeof(sa));
|
memset(&sa, 0, sizeof(sa));
|
||||||
|
|
|
@ -228,7 +228,6 @@ class ExceptionHandler {
|
||||||
const char* next_minidump_id_c_;
|
const char* next_minidump_id_c_;
|
||||||
|
|
||||||
const bool handler_installed_;
|
const bool handler_installed_;
|
||||||
void* signal_stack; // the handler stack.
|
|
||||||
HandlerCallback crash_handler_;
|
HandlerCallback crash_handler_;
|
||||||
|
|
||||||
// The global exception handler stack. This is need becuase there may exist
|
// The global exception handler stack. This is need becuase there may exist
|
||||||
|
|
Loading…
Reference in a new issue