unix/unix_mphal: Properly initialize struct sigaction.

This solves long-standing non-deterministic bug, which manifested itself
on x86 32-bit (at least of reported cases) - segfault on Ctrl+C (i.e.
SIGINT).
This commit is contained in:
Paul Sokolovsky 2015-12-17 23:17:07 +02:00
parent 02fa8dff85
commit 3db2b23060

View File

@ -53,6 +53,7 @@ void mp_hal_set_interrupt_char(char c) {
#ifndef _WIN32 #ifndef _WIN32
// enable signal handler // enable signal handler
struct sigaction sa; struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sa.sa_handler = sighandler; sa.sa_handler = sighandler;
sigemptyset(&sa.sa_mask); sigemptyset(&sa.sa_mask);
sigaction(SIGINT, &sa, NULL); sigaction(SIGINT, &sa, NULL);