mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-27 07:56:14 +01: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:
parent
6f46294227
commit
33948929df
@ -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';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user