Re: fopen bug on Solaris, HP-UX

2008-09-29 Thread Bruno Haible
Hi, Michael Haubenwallner wrote: > How do gnulib's file-functions respect the different sets of > large-file-defines among several platforms in general? The autoconf macro AC_SYS_LARGEFILE does it all. It defines _FILE_OFFSET_BITS, _LARGE_FILES, or whatever system-dependent magic is needed to get

Re: fopen bug on Solaris, HP-UX

2008-09-29 Thread Michael Haubenwallner
On Mon, 2008-09-29 at 10:01 +0200, Michael Haubenwallner wrote: > On Sun, 2008-09-28 at 14:59 +0200, Bruno Haible wrote: > > A followup to this override of open() and fopen(): > > > > > > 2008-09-28 Bruno Haible <[EMAIL PROTECTED]> > > > * lib/stdio.in.h (fopen, freopen): Undefine before

Re: fopen bug on Solaris, HP-UX

2008-09-29 Thread Michael Haubenwallner
On Sun, 2008-09-28 at 14:59 +0200, Bruno Haible wrote: > A followup to this override of open() and fopen(): > > > 2008-09-28 Bruno Haible <[EMAIL PROTECTED]> > * lib/stdio.in.h (fopen, freopen): Undefine before redefining. Needed > with AIX xlc. Maybe I should just try more hard

Re: fopen bug on Solaris, HP-UX

2008-09-28 Thread Bruno Haible
A followup to this override of open() and fopen(): 2008-09-28 Bruno Haible <[EMAIL PROTECTED]> * doc/posix-functions/freopen.texi: Mention the trailing slash problem. * lib/stdio.in.h (fopen, freopen): Undefine before redefining. Needed with AIX xlc. * lib/fcnt

Re: fopen bug on Solaris, HP-UX

2008-09-24 Thread Eric Blake
Paolo Bonzini gnu.org> writes: > > > > ! fd = open (filename, O_RDONLY); > > ! if (fd < 0) > > return NULL; > > > > ! if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode)) > > ! { > > ! errno = ENOTDIR; > > ! return NULL; > > ! } > > You're leaking fd

Re: fopen bug on Solaris, HP-UX

2008-09-24 Thread Paolo Bonzini
> ! fd = open (filename, O_RDONLY); > ! if (fd < 0) > return NULL; > > ! if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode)) > ! { > ! errno = ENOTDIR; > ! return NULL; > ! } You're leaking fd here. Same for open(). Paolo

Re: fopen bug on Solaris, HP-UX

2008-09-24 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Eric Blake on 9/24/2008 6:51 AM: > Thanks. However, right now, if both fopen-safer and fopen are in use, > then it looks like fopen_safer is used without also picking up rpl_fopen. > I'm still looking into the best way to make these modu

Re: fopen bug on Solaris, HP-UX

2008-09-24 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 9/24/2008 5:50 AM: > The bug appears on the same platforms, namely HP-UX and Solaris 9. Therefore > for the moment an extra autoconf check is not needed. But I agree that it > should be worked around. I'm applying the patch

Re: fopen bug on Solaris, HP-UX

2008-09-24 Thread Bruno Haible
Eric Blake wrote: > > * lib/fopen.c (rpl_fopen): Return NULL if the mode specifies write > > access and the filename ends in a slash. Code copied from lib/open.c. > > Should we also check for the bug, present in at least Irix 5.3, where > fopen("/dev/null/","r") succeeds instead of failing

Re: fopen bug on Solaris, HP-UX

2008-09-23 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 8/30/2008 6:39 AM: > Hi, > > The documented open() bug on Solaris [7-9] and HP-UX 11.00 exists also as a > bug in fopen(). I'm applying this to fix it: > * lib/fopen.c (rpl_fopen): Return NULL if the mode specifies

fopen bug on Solaris, HP-UX

2008-08-30 Thread Bruno Haible
Hi, The documented open() bug on Solaris [7-9] and HP-UX 11.00 exists also as a bug in fopen(). I'm applying this to fix it: 2008-08-30 Bruno Haible <[EMAIL PROTECTED]> * m4/fopen.m4 (gl_FUNC_FOPEN): Test against bug with trailing slash. Code copied from m4/open.m4. *