bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mingw fopen bug


From: Eric Blake
Subject: Re: mingw fopen bug
Date: Tue, 23 Sep 2008 06:50:47 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080708 Thunderbird/2.0.0.16 Mnenhy/0.7.5.666

-----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             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

iEYEARECAAYFAkjY5icACgkQ84KuGfSFAYDWHgCcCLdPF+9IS2N6ZG0BKzf827z8
kX4AnRMIStlWDeyNxFtmXltEsAseorkq
=Rz3y
-----END PGP SIGNATURE-----
>From 893230e91b60dc5af88c4cf91ca7c5661fa2829b Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
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 <address@hidden>
---
 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  <address@hidden>
+
+       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  <address@hidden>
             Bruno Haible  <address@hidden>
 
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.
address@hidden
+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
address@hidden, rather than @code{fopen} and @code{fileno}.
 @end itemize
-- 
1.6.0.2


reply via email to

[Prev in Thread] Current Thread [Next in Thread]