From: Daniel G. <dg...@su...> - 2008-10-27 21:25:41
|
Hi, pan segfaults when receiving various signal registered by sigaction. ----->8-------- i386:~ # /usr/lib/ltp/pan/pan -q -e -S -a 24911 -n 24911 -f /root/ftest05 & [1] 25049 i386:~ # killall -SIGINT pan [1]+ Segmentation fault /usr/lib/ltp/pan/pan -q -e -S -a 24911 -n 24911 -f /root/ftest05 ------8<------- Valgrind reports various uninitalied bytes of the sigaction struct: ----->8-------- ==25055== Syscall param rt_sigaction(act->sa_mask) points to uninitialised byte(s) ==25055== at 0x407AA17: __libc_sigaction (in /lib/libc-2.4.so) ==25055== by 0x407AB02: sigaction (in /lib/libc-2.4.so) ==25055== by 0x804AAEF: main (pan.c:448) ==25055== Address 0xbe9763a4 is on thread 1's stack ==25055== ==25055== Syscall param rt_sigaction(act->sa_flags) points to uninitialised byte(s) ==25055== at 0x407AA17: __libc_sigaction (in /lib/libc-2.4.so) ==25055== by 0x407AB02: sigaction (in /lib/libc-2.4.so) ==25055== by 0x804AAEF: main (pan.c:448) ==25055== Address 0xbe97639c is on thread 1's stack ------8<------- Initializing the sigaction struct as empty avoids a segfault of "pan". Signed-off-by: Daniel Gollub <dg...@su...> --- pan/pan.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/pan/pan.c b/pan/pan.c index 457de0f..0ed4be3 100644 --- a/pan/pan.c +++ b/pan/pan.c @@ -444,7 +444,11 @@ main(int argc, char **argv) rec_signal = send_signal = 0; if (run_time != -1) { alarm(run_time); } + + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; sa.sa_handler = wait_handler; + sigaction(SIGALRM, &sa, NULL); sigaction(SIGINT, &sa, NULL); sigaction(SIGTERM, &sa, NULL); |