[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: libc6 and libc6-doc inconsistent?



> void termination_handler(int signum)
> {
> 	 if (termination_handler_in_progress)
> 		raise(signum);
> 	 termination_handler_in_progress = 1;
> 
> 	 if (unlink (SOCKNAME) < 0)
> 	 {
> 		perror("unlink");
> 		exit(EXIT_FAILURE);
> 	 }
> 
> 	 raise(signum);
> }
> According to the libc.info (*See Termination in Handler::),
> the program should end when this function is called (e.g. with
> kill -TERM <pid>). I can modify it by adding another line
> such as 
> 
> 	 signal(signum, SIG_DFL);
> 
> before the last "raise(signum);", but is this a bug in libc6
> or libc6-doc? As I don't have the altdev package installed I
> cannot test it with that at the moment.

The signal handler will only terminate if you have SysV signal
behaviour. (After entering the handler, the handler is reset to
default, i.e. kill; then raising the same signal again will kill the
program.)

If you have BSD behaviour, the causing signal will be blocked during
executing of the handler, thus the raise() takes effect only after
leaving the handler. Since you do the same also if
termination_handler_in_progress is set, you get an endless loop of
signals...

Roman


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: