diff options
| author | Karel Klic <kklic@redhat.com> | 2009-12-18 19:12:50 +0100 |
|---|---|---|
| committer | Karel Klic <kklic@redhat.com> | 2009-12-18 19:12:50 +0100 |
| commit | e7661d7e411172ddad8838040ded025ad6bfbb14 (patch) | |
| tree | f2451b553b4fcf959bd2bfc29172f9fb855e5fdd /src/Daemon/Daemon.cpp | |
| parent | ce1904e24b576a7356488852a240d777717b2598 (diff) | |
| parent | 46b2fb8df8d4e025f5bbdd9f53be1f658a9e82c6 (diff) | |
| download | abrt-e7661d7e411172ddad8838040ded025ad6bfbb14.tar.gz abrt-e7661d7e411172ddad8838040ded025ad6bfbb14.tar.xz abrt-e7661d7e411172ddad8838040ded025ad6bfbb14.zip | |
Merge branch 'master' of git://git.fedorahosted.org/git/abrt
Diffstat (limited to 'src/Daemon/Daemon.cpp')
| -rw-r--r-- | src/Daemon/Daemon.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp index c6cae5d..8038f75 100644 --- a/src/Daemon/Daemon.cpp +++ b/src/Daemon/Daemon.cpp @@ -110,7 +110,7 @@ typedef struct cron_callback_data_t } cron_callback_data_t; -static uint8_t s_sig_caught; /* must be one byte */ +static volatile sig_atomic_t s_sig_caught; static int s_signal_pipe[2]; static int s_signal_pipe_write = -1; static unsigned s_timeout; @@ -216,14 +216,14 @@ static int SetUpCron() std::string sM = ""; sH = it_c->first.substr(0, pos); - nH = atoi(sH.c_str()); + nH = xatou(sH.c_str()); nH = nH > 23 ? 23 : nH; nH = nH < 0 ? 0 : nH; nM = nM > 59 ? 59 : nM; nM = nM < 0 ? 0 : nM; timeout += nH * 60 * 60; sM = it_c->first.substr(pos + 1); - nM = atoi(sM.c_str()); + nM = xatou(sM.c_str()); timeout += nM * 60; } else @@ -231,7 +231,7 @@ static int SetUpCron() std::string sS = ""; sS = it_c->first; - nS = atoi(sS.c_str()); + nS = xatou(sS.c_str()); nS = nS <= 0 ? 1 : nS; timeout = nS; } @@ -399,10 +399,15 @@ static int Lock() static void handle_fatal_signal(int signo) { - s_sig_caught = signo; - VERB3 log("Got signal %d", signo); + // Enable for debugging only, malloc/printf are unsafe in signal handlers + //VERB3 log("Got signal %d", signo); + + uint8_t l_sig_caught; + s_sig_caught = l_sig_caught = signo; + /* Using local copy of s_sig_caught so that concurrent signal + * won't change it under us */ if (s_signal_pipe_write >= 0) - write(s_signal_pipe_write, &s_sig_caught, 1); + write(s_signal_pipe_write, &l_sig_caught, 1); } /* Signal pipe handler */ |
