Re: [PATCHES] Bad bug in fopen() wrapper code - Mailing list pgsql-hackers

From Zeugswetter Andreas DCP SD
Subject Re: [PATCHES] Bad bug in fopen() wrapper code
Date
Msg-id E1539E0ED7043848906A8FF995BDA579016265A3@m0143.s-mxs.net
Whole thread Raw
In response to Re: [PATCHES] Bad bug in fopen() wrapper code  (Bruce Momjian <bruce@momjian.us>)
Responses Re: [PATCHES] Bad bug in fopen() wrapper code
List pgsql-hackers
> Magnus, is this the right fix?

Well, actually msdn states:

"Return Value
 If successful, _setmode returns the previous translation mode. A return
value of -1 indicates an error"

So, shouldn't we be testing for -1 instead of < 0 ?

The thing is probably academic, since _setmode is only supposed to fail
on invalid file handle or invalid mode.
So basically, given our code, it should only fail if filemode is
(O_BINARY | O_TEXT) both flags set.

Andreas

pgsql-hackers by date:

Previous
From: Jeremy Drake
Date:
Subject: Re: src/tools/msvc usage instructions
Next
From: "Zeugswetter Andreas DCP SD"
Date:
Subject: Re: Faster StrNCpy