-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Bruno Haible on 9/23/2008 5:25 AM: >> In an effort to unify this behavior, I was considering making m4 1.4.12 >> pre-reject directories with EISDIR > > Then I would split the fopen() call into open() + fdopen(), and use fstat() > between the two operations to detect the case of a directory. This is not > racy, and it never runs into the EACCES case on mingw.
I'm committing this patch, to cover the advice. - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -----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 iEYEARECAAYFAkjY5icACgkQ84KuGfSFAYDWHgCcCLdPF+9IS2N6ZG0BKzf827z8 kX4AnRMIStlWDeyNxFtmXltEsAseorkq =Rz3y -----END PGP SIGNATURE-----
>From 893230e91b60dc5af88c4cf91ca7c5661fa2829b Mon Sep 17 00:00:00 2001 From: Eric Blake <[EMAIL PROTECTED]> Date: Tue, 23 Sep 2008 06:48:07 -0600 Subject: [PATCH] fopen: document mingw bug on directories * doc/posix-functions/fopen.texi (fopen): Mention mingw bug for not allowing a stream visiting a directory, even though reading from such a stream is not portable. Signed-off-by: Eric Blake <[EMAIL PROTECTED]> --- ChangeLog | 7 +++++++ doc/posix-functions/fopen.texi | 6 ++++++ 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/ChangeLog b/ChangeLog index 41e6aad..5c42883 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-09-23 Eric Blake <[EMAIL PROTECTED]> + + fopen: document mingw bug on directories + * doc/posix-functions/fopen.texi (fopen): Mention mingw bug for + not allowing a stream visiting a directory, even though reading + from such a stream is not portable. + 2008-09-22 Eric Blake <[EMAIL PROTECTED]> Bruno Haible <[EMAIL PROTECTED]> diff --git a/doc/posix-functions/fopen.texi b/doc/posix-functions/fopen.texi index da6acde..442d1b6 100644 --- a/doc/posix-functions/fopen.texi +++ b/doc/posix-functions/fopen.texi @@ -26,4 +26,10 @@ upon failure. On Windows, this function returns a file stream in ``text'' mode by default; this means that it translates @code{'\n'} to CR/LF by default. Use the @code{"b"} flag if you need reliable binary I/O. [EMAIL PROTECTED] +On Windows platforms (excluding Cygwin), this function fails to open +directories for reading. Such streams have implementation-defined +semantics on other platforms. To avoid directory streams with a +consistent error message, use @code{fstat} after @code{open} and [EMAIL PROTECTED], rather than @code{fopen} and @code{fileno}. @end itemize -- 1.6.0.2