Created attachment 6903 [details]
Add alternatives to dirfd() for systems that don't have it
Some systems, such as Solaris 10, don't have dirfd(), but do have
members in the DIR struct that can be used instead (specifically,
the d_fd and dd_fd members). The attached patch detects if any of
those are present and falls back using one of them if dirfd() is
the need for dirfd was removed already quite a while ago.