mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-10 12:38:54 +02:00
gspawn: Don’t use g_ascii_isdigit() in async-signal-safe context
While `g_ascii_isdigit()` *is* currently async-signal-safe, it’s going to be hard to remember to keep it that way if the implementation changes in future. It seems more robust to just reimplement it here, given that it’s not much code. See `man 7 signal-safety`. Signed-off-by: Philip Withnall <withnall@endlessm.com> Helps: #2140
This commit is contained in:
@ -1185,8 +1185,7 @@ filename_to_fd (const char *p)
|
|||||||
|
|
||||||
while ((c = *p++) != '\0')
|
while ((c = *p++) != '\0')
|
||||||
{
|
{
|
||||||
/* FIXME: g_ascii_isdigit() is not necessarily async-signal-safe. */
|
if (c < '0' || c > '9')
|
||||||
if (!g_ascii_isdigit (c))
|
|
||||||
return -1;
|
return -1;
|
||||||
c -= '0';
|
c -= '0';
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user