Hi Paul, > Can dirfd really return -1 on real platforms, when its argument is a valid > open directory stream? POSIX allows that behavior, but I don't know > of any implementations that do it.
Nothing of this sort is known for Unix platforms, but gnulib/doc/posix-functions/dirfd.texi mentions that this problem exists on mingw: Portability problems not fixed by Gnulib: @itemize @item This function always fails on some platforms: mingw. @end itemize Also, see the comment in lib/fchdir.c: "FIXME - make dirfd possible on mingw". So, for modules that attempt portability to mingw - and 'getcwd' and 'glob' are certainly in this group - you shouldn't use dirfd for essential purposes, but rather use file names and 'DIR *' pointers. Bruno
