Subject: bug#65919: master 160b4c295d8: ; * src/process.c (child_signal_notify): Avoid compiler warning (bug#65919).

From: Paul Eggert <[email-masked]>
Date: Mon, 18 Sep 2023 12:35:26 -0700

On 2023-09-18 06:51, Robert Pluim wrote:
> Is it worth the effort to use strerror_r-posix here from Gnulib?

I don't think that'd suffice, since POSIX does not require strerror_r to 
be async-signal-safe 
<https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/functions/V2_chap02.html#tag_15_04_03_03>.

Emacs could instead convert the error number to the textual 
representation of a decimal number and write that text to stderr; that 
would be async-signal-safe if done without using sprintf etc. The error 
number wouldn't be as nice as a strerror string but it would be better 
than nothing.

If you want to be fancier, whenever Emacs calls setlocale it could cache 
all the possible strerror strings into storage that safe to be used in a 
signal handler, and use one of those strings if available, outputting a 
decimal number otherwise.