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

Поиск
Список
Период
Сортировка
От Magnus Hagander
Тема Re: [PATCHES] Bad bug in fopen() wrapper code
Дата
Msg-id 6BCB9D8A16AC4241919521715F4D8BCEA0FBED@algol.sollentuna.se
обсуждение исходный текст
Ответ на Re: [PATCHES] Bad bug in fopen() wrapper code  ("Claudio Natoli" <claudio.natoli@memetrics.com>)
Список pgsql-hackers
> > What's bugging me is that 0 and O_EXCL give the same answer, and
> > O_TRUNC and O_TRUNC | O_EXCL give the same answer,
>
> This is ok, as (iirc) O_EXCL only has effect in the presence
> of O_CREAT.

<snip more explanation>

Thanks, Claudio!

After looking at the code some more, and actually reading up on the
specs a bit more, it certainly does look like it's safe. So I don't
think we need to do anything about that.

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)))


With the _setmode() call deep in the if statement... I would suggest we
split that up into a couple of lines to make it more readable - I'm sure
all compilers will easily optimise it into the same code anyway.
Reasonable?

//Magnus

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Zdenek Kotala
Дата:
Сообщение: Re: horo(r)logy test fail on solaris (again and solved)
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Block B-Tree concept