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

From Claudio Natoli
Subject Re: [PATCHES] Bad bug in fopen() wrapper code
Date
Msg-id C9A33A2803C7F3479A02A333328A174756CAB2@ewell.memetrics.local
Whole thread Raw
Responses Re: [PATCHES] Bad bug in fopen() wrapper code  ("Magnus Hagander" <mha@sollentuna.net>)
List pgsql-hackers
Hello guys,

it's been a while, but...

> 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.
(a comment to this effect would help here, as well as perhaps links to the CreateFile and open specs)


> but O_CREAT and O_CREAT | O_EXCL give different answers,
> as do O_CREAT | O_TRUNC and O_CREAT | O_TRUNC | O_EXCL.

See above.


> I'm also pretty suspicious of both O_CREAT | O_EXCL and
> O_CREAT | O_TRUNC | O_EXCL giving the same answer.

O_CREAT | O_EXCL is effectively "create, but fail if the file exists", which is the behaviour specified by CREATE_NEW.
AddingO_TRUNC to this combination, which can only apply to a successfully opened existent file, can have no impact
afaics.

Cheers,
Claudio

pgsql-hackers by date:

Previous
From: Gevik Babakhani
Date:
Subject: TODO: Fix CREATE CAST on DOMAIN Part II
Next
From: Bruce Momjian
Date:
Subject: Re: pgsql: We're going to have to spell dotless i