gspawn: Handle ENOSYS from close_range()
It’s possible that GLib will eventually be compiled against a version of
libc which supports close_range()
(hence HAVE_CLOSE_RANGE
will be
defined), but then run against an older kernel which doesn’t support it.
In this case, we want to fall back to fdwalk()
, which should work on
such systems.
This is what cpython does: https://github.com/python/cpython/blob/3529718925f40d14ed48d281d809187bc7314a14/Python/fileutils.c#L2227
Spotted by Allison Karlitskaya in !1688 (merged).
Signed-off-by: Philip Withnall pwithnall@endlessos.org