mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
Fix uninitialized sigaction.sa_flags valgrind error
Valgrind warns that the sometimes uninitialized sigaction.sa_flags field is sometimes used when passed to the signal handler. This patch explicitly zeros out the sigaction.sa_flags field at creation time.
This commit is contained in:
parent
99d2a344c7
commit
e656654456
1 changed files with 5 additions and 0 deletions
|
@ -267,6 +267,8 @@ void signal_reset_handlers() {
|
|||
|
||||
static void set_interactive_handlers() {
|
||||
struct sigaction act, oact;
|
||||
act.sa_flags = 0;
|
||||
oact.sa_flags = 0;
|
||||
sigemptyset(&act.sa_mask);
|
||||
|
||||
// Interactive mode. Ignore interactive signals. We are a shell, we know what is best for
|
||||
|
@ -312,6 +314,7 @@ static void set_interactive_handlers() {
|
|||
|
||||
static void set_non_interactive_handlers() {
|
||||
struct sigaction act;
|
||||
act.sa_flags = 0;
|
||||
sigemptyset(&act.sa_mask);
|
||||
|
||||
// Non-interactive. Ignore interrupt, check exit status of processes to determine result
|
||||
|
@ -324,6 +327,7 @@ static void set_non_interactive_handlers() {
|
|||
/// Sets up appropriate signal handlers.
|
||||
void signal_set_handlers() {
|
||||
struct sigaction act;
|
||||
act.sa_flags = 0;
|
||||
sigemptyset(&act.sa_mask);
|
||||
|
||||
// Ignore SIGPIPE. We'll detect failed writes and deal with them appropriately. We don't want
|
||||
|
@ -355,6 +359,7 @@ void signal_handle(int sig, int do_handle) {
|
|||
(sig == SIGTTOU) || (sig == SIGCHLD))
|
||||
return;
|
||||
|
||||
act.sa_flags = 0;
|
||||
sigemptyset(&act.sa_mask);
|
||||
if (do_handle) {
|
||||
act.sa_flags = SA_SIGINFO;
|
||||
|
|
Loading…
Reference in a new issue