-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Eric Blake on 8/31/2009 3:35 PM: > One of the main reasons the fchdir module was added was so that the openat > module (and friends) would compile on mingw. Well, it turns out that mingw > has > the (documented) limitation that open(dir,O_RDONLY) fails with EACCES, so > rpl_open was never registering an fd visiting a directory in the first place, > and the fchdir replacement (and thus openat and fts) failed to run on mingw. > The first patch improves things by adding a fchdir unit test, and teaches > rpl_open how to fake out opening a directory (the end result of > using "/dev/null" under the hood means that read() on the fd gives the same > EOF > results as on Linux; and replacing fstat() means we can hide the fact that we > used a dummy).
Pushed the first one; I'll wait a bit longer for any more review before pushing the second (since it changes the implementation of fchdir) or the subsequent fdopendir patches. > Subject: [PATCH 1/2] fchdir: port to mingw > > * m4/fchdir.m4 (gl_FUNC_FCHDIR): Check for mingw bug. > * lib/open.c (open) [FCHDIR_REPLACEMENT]: If directories can't be > opened, then use a substitute. > * lib/sys_stat.in.h (fstat) [REPLACE_OPEN_DIRECTORY]: Declare > replacement. > * lib/fchdir.c (fstat) [REPLACE_OPEN_DIRECTORY]: Implement it. > (_gl_register_fd): No need to check stat if open already filters > all directories. > (fchdir): Fix error condition to match POSIX. > * modules/fchdir (Depends-on): Add sys_stat. > * doc/posix-functions/open.texi (open): Document the limitation. > * modules/fchdir-tests: New file. > * tests/test-fchdir.c: Likewise. - -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkqcolwACgkQ84KuGfSFAYBCWwCcCkOO6YkzMbTphFCsHIqbs474 PEAAoJN4VaMMuLSQg4cLTUUftfzSTWK0 =rJu1 -----END PGP SIGNATURE-----