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

2006-09-30 Thread Tom Lane
"Claudio Natoli" <[EMAIL PROTECTED]> 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 h

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

2006-09-27 Thread Claudio Natoli
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))) > > > With the _setmode() call deep in th

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

2006-09-27 Thread Magnus Hagander
> > 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. Thanks, Claudio! After looking at the code some more, and actually reading up on the spec

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

2006-09-24 Thread Claudio Natoli
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 l

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

2006-09-24 Thread Tom Lane
"Magnus Hagander" <[EMAIL PROTECTED]> writes: > This is pretty bad and pretty urgent - with this, systems installed by > the MSI installer simply *do not start*, because they are by default > configured to write logs to a file... > Attached patch sets the O_CREAT option when appending to files.

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

2006-09-24 Thread Tom Lane
"Magnus Hagander" <[EMAIL PROTECTED]> writes: > That is part of the original open() code that Claudio did back for 8.0, > so it has definitly been working since then. Hm, maybe best not to touch it, but still... > I haven't really read into > the code, though... But a qiuck look doesn't show me a

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

2006-09-24 Thread Magnus Hagander
> > Attached patch sets the O_CREAT option when appending to files. > > That looks correct, but I went looking to see if there were > any other mistakes of the same ilk, and I'm wondering what > the sense is in openFlagsToCreateFileFlags ... seems like > it's ignoring O_EXCL in some combinatio

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

2006-09-24 Thread Tom Lane
"Magnus Hagander" <[EMAIL PROTECTED]> writes: > Attached patch sets the O_CREAT option when appending to files. That looks correct, but I went looking to see if there were any other mistakes of the same ilk, and I'm wondering what the sense is in openFlagsToCreateFileFlags ... seems like it's ign