From 50b2fe17fb9706cce9c7965bab6a137e40572931 Mon Sep 17 00:00:00 2001 From: rd235 Date: Mon, 14 Feb 2011 17:54:56 +0000 Subject: [PATCH] bugfix: sigmask not initialized in qtimer (tnx megurikuru) git-svn-id: https://vde.svn.sourceforge.net/svnroot/vde/trunk@474 d37a7db1-d92d-0410-89df-f68f52f87b57 --- vde-2/src/vde_switch/qtimer.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/vde-2/src/vde_switch/qtimer.c b/vde-2/src/vde_switch/qtimer.c index 323e30f..e0b2860 100644 --- a/vde-2/src/vde_switch/qtimer.c +++ b/vde-2/src/vde_switch/qtimer.c @@ -89,7 +89,7 @@ unsigned int qtimer_add(time_t period,int times,void (*call)(),void *arg) qth[n]->qt_arg=arg; qth[n]->qt_times=(times==0)?-1:times; qtime_csexit(); - return qth[n]->qt_n; + return qth[n]->qt_n; } else return -1; } @@ -139,15 +139,17 @@ void qtimer_init() struct itimerval it; struct sigaction sa; - sa.sa_handler = sig_alarm; - sa.sa_flags = SA_RESTART; - if(sigaction(SIGALRM, &sa, NULL) < 0){ + sa.sa_handler = sig_alarm; + sa.sa_flags = SA_RESTART; + sigemptyset(&sa.sa_mask); + + if(sigaction(SIGALRM, &sa, NULL) < 0){ printlog(LOG_WARNING,"Setting handler for SIGALRM %s", strerror(errno)); return; - } - + } + sigemptyset(&ss_alarm); - sigaddset(&ss_alarm,SIGALRM); + sigaddset(&ss_alarm, SIGALRM); it.it_value.tv_sec = 1; it.it_value.tv_usec = 0 ; -- 2.11.4.GIT