Re: [HACKERS] Bad bug in fopen() wrapper code

From: "Zeugswetter Andreas DCP SD" <ZeugswetterA(at)spardat(dot)at>
To: "Bruce Momjian" <bruce(at)momjian(dot)us>, "Magnus Hagander" <mha(at)sollentuna(dot)net>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-hackers(at)postgresql(dot)org>, "Claudio Natoli" <claudio(dot)natoli(at)memetrics(dot)com>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] Bad bug in fopen() wrapper code
Date: 2006-10-03 08:20:11
Message-ID: E1539E0ED7043848906A8FF995BDA579016265A3@m0143.s-mxs.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


> 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zeugswetter Andreas DCP SD 2006-10-03 08:24:10 Re: Faster StrNCpy
Previous Message Jeremy Drake 2006-10-03 07:27:47 Re: src/tools/msvc usage instructions

Browse pgsql-patches by date

  From Date Subject
Next Message Zeugswetter Andreas DCP SD 2006-10-03 08:24:10 Re: Faster StrNCpy
Previous Message Magnus Hagander 2006-10-03 05:50:27 Re: [HACKERS] Bad bug in fopen() wrapper code