Skip to content
Snippets Groups Projects
Commit 3db2b230 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

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).
parent 02fa8dff
Branches
No related tags found
No related merge requests found
...@@ -53,6 +53,7 @@ void mp_hal_set_interrupt_char(char c) { ...@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment