[Win32] do_spawn_directly problems
Submitted by Morten Welinder
Link to original bug (#619564)
Description
In gspawn-win32.c, I see the following near line 486:
g_free (wargv0);
g_strfreev ((gchar **) wargv);
g_strfreev ((gchar **) wenvp);
saved_errno = errno;
if (rc == -1 && saved_errno != 0)
{
g_set_error (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED,
_("Failed to execute child process (%s)"),
g_strerror (saved_errno));
return FALSE;
}
There are two problems with this:
- "errno" is saved too late. It must be saved before the free-ing.
- G_SPAWN_ERROR_FAILED --> G_SPAWN_ERROR_NOENT to match what happens on the Linux side.
Edited by Christoph Reiter