[Top][All Lists]

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

Re: mingw fopen bug

From: Bruno Haible
Subject: Re: mingw fopen bug
Date: Tue, 23 Sep 2008 13:25:43 +0200
User-agent: KMail/1.5.4

Eric Blake wrote:
> The use case where I discovered this bug was with m4 1.4.11.  Compare:
> mingw$ m4 .
> m4.exe: .: Permission denied
> Linux$ m4 .
> m4:/:1: Read error
> OpenBSD$ m4 . && echo done
> done
> EMX$ m4 .
> <starts trying to interpret struct dirent records as m4 input>
> In an effort to unify this behavior, I was considering making m4 1.4.12
> pre-reject directories with EISDIR (POSIX allows this, since directories
> are not text files, and m4 is only required to operate on text files),
> while remembering that doing stat() prior to fopen() is racy.

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.


reply via email to

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