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.

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

-- 
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT 
Lecturer.
+44 (0) 787 668 0256  https://www.phcomp.co.uk/
Parliament Hill Computers. Registration Information: 
https://www.phcomp.co.uk/Contact.html
#include <std_disclaimer.h>

Reply via email to