Marcin is right. We must be very cautious, what a signal handler does.The
list in the sigaction manpage is nice finding. Thank you! In screen it
prooved to be fatal, if a signal handler does malloc()/free(). That easily
leads to invalid pointers in the rest of the code.

 take care,
Jürgen-

Marcin Cieślak <invalid.nore...@gnu.org> schrieb am Sa., 28. Dez. 2019
20:35:

> Follow-up Comment #12, bug #25089 (project screen):
>
> The reason for this is that in the C language only some very narrow set of
> library functions can be invoked from the signal handler
>
> FreeBSD sigaction(2) manpage lists them and adds:
>
>
> https://www.freebsd.org/cgi/man.cgi?query=sigaction&apropos=0&sektion=2&manpath=FreeBSD+12.1-RELEASE+and+Ports&arch=default&format=html
>
> > All functions not in the above lists are considered to be unsafe with
> > respect to signals.  That is to say, the behaviour of such functions is
> > undefined when they are called from a signal handler that interrupted an
> > unsafe function.  In general though, signal handlers should do little
> > more than set a flag; most other actions are not safe.
>
> Therefore it was the best practice in the signal handlers only to   set the
> variable and deal with the actual handling later.
>
>     _______________________________________________________
>
> Reply to this item at:
>
>   <https://savannah.gnu.org/bugs/?25089>
>
> _______________________________________________
>   Message sent via Savannah
>   https://savannah.gnu.org/
>
>
>

Reply via email to