Re: [PATCHES] Bad bug in fopen() wrapper code
От
Tom Lane
Тема
Re: [PATCHES] Bad bug in fopen() wrapper code
Дата
Msg-id
14631.1159638870@sss.pgh.pa.us
Ответ на
Re: [PATCHES] Bad bug in fopen() wrapper code (Claudio Natoli)
Список
Дерево обсуждения
Re: [PATCHES] Bad bug in fopen() wrapper code "Claudio Natoli" <claudio.natoli@memetrics.com>
Re: [PATCHES] Bad bug in fopen() wrapper code Tom Lane <tgl@sss.pgh.pa.us>
Re: [PATCHES] Bad bug in fopen() wrapper code "Magnus Hagander" <mha@sollentuna.net>
Re: [PATCHES] Bad bug in fopen() wrapper code Tom Lane <tgl@sss.pgh.pa.us>
Re: [PATCHES] Bad bug in fopen() wrapper code Bruce Momjian <bruce@momjian.us>
Re: [PATCHES] Bad bug in fopen() wrapper code Bruce Momjian <bruce@momjian.us>
Re: [PATCHES] Bad bug in fopen() wrapper code Bruce Momjian <bruce@momjian.us>
Re: [PATCHES] Bad bug in fopen() wrapper code "Magnus Hagander" <mha@sollentuna.net>
Re: [PATCHES] Bad bug in fopen() wrapper code "Magnus Hagander" <mha@sollentuna.net>
Re: [PATCHES] Bad bug in fopen() wrapper code "Zeugswetter Andreas DCP SD" <ZeugswetterA@spardat.at>
Re: [PATCHES] Bad bug in fopen() wrapper code Tom Lane <tgl@sss.pgh.pa.us>
"Claudio Natoli" writes: > Magnus Hagander writes: >> Now, I still twist my head around the lines: >> if ((fd = _open_osfhandle((long) h, fileFlags & O_APPEND)) < 0 >> || >> (fileFlags & (O_TEXT | O_BINARY) && (_setmode(fd, >> fileFlags & (O_TEXT | O_BINARY)) < 0))) > Without having studied it closely, it might also highlight a bug on failure of the second clause -- if the _setmode fails, shouldn't _close be called instead of CloseHandle, and -1 returned? (CloseHandle would still be called on failure of the _open_osfhandle, obviously) I agree that this code is both wrong and unreadable (although in practice the _setmode will probably never fail, which is why our attention hasn't been drawn to it). Is someone going to submit a patch? I'm hesitant to change the code myself since I'm not in a position to test it. regards, tom lane
В списке pgsql-hackers по дате отправления