Fix use of uninitialized memory in sigaction structure.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2013-11-17 09:55:18 +04:00
parent 255cc340b5
commit bb65b46790
6 changed files with 10 additions and 10 deletions

View File

@ -93,12 +93,11 @@ tty_setup_sigwinch (void (*handler) (int))
#if (NCURSES_VERSION_MAJOR >= 4) && defined (SIGWINCH)
struct sigaction act, oact;
memset (&act, 0, sizeof (act));
act.sa_handler = handler;
sigemptyset (&act.sa_mask);
#ifdef SA_RESTART
act.sa_flags = SA_RESTART;
#else
act.sa_flags = 0;
#endif /* SA_RESTART */
sigaction (SIGWINCH, &act, &oact);
#endif /* SIGWINCH */

View File

@ -33,6 +33,7 @@
#include <signal.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h> /* memset() */
#include <unistd.h> /* exit() */
#ifdef HAVE_SYS_IOCTL_H
@ -118,12 +119,11 @@ tty_start_interrupt_key (void)
{
struct sigaction act;
memset (&act, 0, sizeof (act));
act.sa_handler = sigintr_handler;
sigemptyset (&act.sa_mask);
#ifdef SA_RESTART
act.sa_flags = SA_RESTART;
#else
act.sa_flags = 0;
#endif /* SA_RESTART */
sigaction (SIGINT, &act, NULL);
}
@ -135,9 +135,9 @@ tty_enable_interrupt_key (void)
{
struct sigaction act;
memset (&act, 0, sizeof (act));
act.sa_handler = sigintr_handler;
sigemptyset (&act.sa_mask);
act.sa_flags = 0;
sigaction (SIGINT, &act, NULL);
got_interrupt = 0;
}
@ -149,9 +149,9 @@ tty_disable_interrupt_key (void)
{
struct sigaction act;
memset (&act, 0, sizeof (act));
act.sa_handler = SIG_IGN;
sigemptyset (&act.sa_mask);
act.sa_flags = 0;
sigaction (SIGINT, &act, NULL);
}

View File

@ -180,9 +180,9 @@ my_system__save_sigaction_handlers (my_system_sigactions_t * sigactions)
{
struct sigaction ignore;
memset (&ignore, 0, sizeof (ignore));
ignore.sa_handler = SIG_IGN;
sigemptyset (&ignore.sa_mask);
ignore.sa_flags = 0;
sigaction (SIGINT, &ignore, &sigactions->intr);
sigaction (SIGQUIT, &ignore, &sigactions->quit);

View File

@ -29,6 +29,7 @@
#include <stdlib.h>
#include <signal.h>
#include <string.h> /* memset() */
#include "lib/global.h"
@ -68,8 +69,8 @@ tcp_init (void)
return;
got_sigpipe = 0;
memset (&sa, 0, sizeof (sa));
sa.sa_handler = sig_pipe;
sa.sa_flags = 0;
sigemptyset (&sa.sa_mask);
sigaction (SIGPIPE, &sa, NULL);

View File

@ -154,6 +154,7 @@ do_suspend_cmd (void)
{
struct sigaction sigtstp_action;
memset (&sigtstp_action, 0, sizeof (sigtstp_action));
/* Make sure that the SIGTSTP below will suspend us directly,
without calling ncurses' SIGTSTP handler; we *don't* want
ncurses to redraw the screen immediately after the SIGCONT */

View File

@ -203,6 +203,7 @@ init_sigchld (void)
{
struct sigaction sigchld_action;
memset (&sigchld_action, 0, sizeof (sigchld_action));
sigchld_action.sa_handler =
#ifdef ENABLE_SUBSHELL
mc_global.tty.use_subshell ? sigchld_handler :
@ -213,8 +214,6 @@ init_sigchld (void)
#ifdef SA_RESTART
sigchld_action.sa_flags = SA_RESTART;
#else
sigchld_action.sa_flags = 0;
#endif /* !SA_RESTART */
if (sigaction (SIGCHLD, &sigchld_action, NULL) == -1)