This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cygwin 1.7 fstat weirdness


Matt Wozniski wrote:
> On Mon, Apr 6, 2009 at 4:11 PM, Corinna Vinschen wrote:
>> On Apr  6 14:46, Gregg Reynolds wrote:
>>>   int fd = path ? open(path, O_RDONLY, TCFILEMODE) : 0;  // path = "Makefile"
>> Is fd == 0 by any chance?  The above code silently sets fd to 0 if it
>> can't open path.
> 
> Unless I'm missing something, that code sets fd to 0 if path is
> NULL... which doesn't seem to make any sense at all, since 0 is a
> valid file descriptor number...

  I often do exactly that when I'm writing a commandline utility that can take
an option to direct output to a file and otherwise writes it to stdout.
(However I agree that that's probably not what is going on in this situation).

    cheers,
      DaveK



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]