On Tue, Mar 24, 2026 at 4:18 AM alain williams <[email protected]> wrote:

> On Tue, Mar 24, 2026 at 12:01:23AM -0400, Jeffrey Walton wrote:
>
> > You have to be careful of what you do in a signal handler.  If the
> > editor is trying to log messages to a log file like, "Received SIGTERM
> > on 03/23/2026 22:00:00", then things could get very tricky.  That's
> > because any system call made must be AS-Safe a/k/a Asynchronous Signal
> > Safe.  If the call is not AS-Safe, then that is Undefined Behavior
> > (UB) and you should expect nasal demons.
>
> I am well aware of that. The signal handler code is careful to not use
> stdio -
> so thus open()/close()/write(); things like localtime() not used.
>
> It does use strsignal() & strerror() which I am a bit dubious about.
>

strsignal() and strerror() are _NOT_ AS-Safe.  They are not listed under
"Async-signal-safe functions" in signal(7) man page.  Remove calls to them.

It does use sprintf() (%ld) which I think should be safe.


sprintf() is _NOT_ AS-Safe.  It is not listed under "Async-signal-safe
functions" in signal(7) man page.  Remove calls to it.

Jeff

Reply via email to