Work around fdopendir() missing on some platforms.