[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fchdir on mingw
From: |
Eric Blake |
Subject: |
Re: fchdir on mingw |
Date: |
Mon, 31 Aug 2009 22:26:04 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 |
-----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 address@hidden
-----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-----
- Re: fchdir on mingw,
Eric Blake <=