(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/lib-signals.c) |
| |
| 197 | | | void lib_signals_ignore(int signo, bool restart_syscalls) |
| 198 | | | { |
| 199 | | | struct sigaction act; |
| 200 | | | |
| 201 | | | if (signo < 0 || signo > MAX_SIGNAL_VALUE) { |
| 202 | | | i_panic("Trying to ignore signal %d, but max is %d", |
| 203 | | | signo, MAX_SIGNAL_VALUE); |
| 204 | | | } |
| 205 | | | |
| 206 | | | i_assert(signal_handlers[signo] == NULL);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/macros.h |
| |
189 | #define i_assert(expr) STMT_START{ \ |
190 | if (unlikely(!(expr))) \ |
191 | i_panic("file %s: line %d (%s): assertion failed: (%s)", \ |
192 | __FILE__, \ |
193 | __LINE__, \ |
194 | __PRETTY_FUNCTION__, \ |
195 | #expr); }STMT_END |
| |
|
| 207 | | | |
| 208 | | | if (sigemptyset(&act.sa_mask) < 0) |
Redundant Condition
sigemptyset(&act.sa_mask) < 0 always evaluates to false. This may be because: - There is a constant assignment to one or more of the variables involved.
- An earlier conditional statement has already ensured that sigemptyset(&act.sa_mask) < 0 cannot be true.
- A crashing bug occurs on every path where sigemptyset(&act.sa_mask) < 0 could have evaluated to true. Look for a preceding Null Pointer Dereference or Division By Zero warning.
|
|
| 209 | | | i_fatal("sigemptyset(): %m"); |
| 210 | | | if (restart_syscalls) { |
| 211 | | | act.sa_flags = SA_RESTART;
x /usr/include/bits/sigaction.h |
| |
62 | # define SA_RESTART 0x10000000 /* Restart syscall on signal return. */ |
| |
|
| 212 | | | act.sa_handler = SIG_IGN;
x /usr/include/bits/sigaction.h |
| |
37 | # define sa_handler __sigaction_handler.sa_handler |
| |
x /usr/include/bits/signum.h |
| |
25 | #define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */ |
| |
|
| 213 | | | } else { |
| 214 | | | act.sa_flags = SA_SIGINFO;
x /usr/include/bits/sigaction.h |
| |
56 | #define SA_SIGINFO 4 /* Invoke signal-catching function with |
| |
|
| 215 | | | act.sa_sigaction = sig_ignore;
x /usr/include/bits/sigaction.h |
| |
38 | # define sa_sigaction __sigaction_handler.sa_sigaction |
| |
|
| 216 | | | } |
| 217 | | | |
| 218 | | | if (sigaction(signo, &act, NULL) < 0) |
| 219 | | | i_fatal("sigaction(%d): %m", signo); |
| 220 | | | } |
| |