gspawn: Don’t use g_close() in async-signal-safe context

Use normal `close()` instead, which is guaranteed to be
async-signal-safe.

See `man 7 signal-safety`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #2140
This commit is contained in:
Philip Withnall 2020-06-22 13:09:56 +01:00
parent 0e05ef7750
commit 6f46294227

View File

@ -155,6 +155,7 @@ extern char **environ;
*/
static gint safe_close (gint fd);
static gint g_execute (const gchar *file,
gchar **argv,
@ -273,8 +274,7 @@ close_and_invalidate (gint *fd)
return;
else
{
/* FIXME: g_close() is not async-signal-safe on failure. */
(void) g_close (*fd, NULL);
safe_close (*fd);
*fd = -1;
}
}