Daniel,

> On Tue, Oct 04, 2005 at 11:37:30AM +0200, Michael Kerrisk wrote:
> > >   strerror(3) claims that strerror_r returns an integer that is zero
> > > for 
> > > success and non-zero for failure; in fact, it returns a char * and 
> > > the code 
> > > appears to say that there is no way to distinguish success and 
> > > failure; if the buffer is too small the string is just truncated.
> > 
> > Daniel,
> > 
> > I am _not_ looking at the Debian sources, but at recent glibc 
> > vanilla sources.   According to those (sysdeps/generic/xpg-strerror.c), 
> > the (vanilla) manual pages that I maintain are correct, *if* one
> > defines _XOPEN_SOURCE as 600, as the manual page specifies:
> > 
> >        #define _XOPEN_SOURCE 600
> >        #include <string.h>
> > 
> >        int strerror_r(int errnum, char *buf, size_t n);
> 
>   No reference to _XOPEN_SOURCE appears in the manpage I'm looking at.

It came in with man-pages-2.04 (Jun 2005).  Debian man-pages are 
lagging a bit behind me at the moment.

> SYNOPSIS
>        #include <string.h>
> 
>        char *strerror(int errnum);
>        int strerror_r(int errnum, char *buf, size_t n);
> 
> 
> > The (vanilla) manual page also has the following text uner 
> > CONFORMING TO:
> > 
> >        An incompatible function, with prototype
> > 
> >        char *strerror_r(int errnum, char *buf, size_t n);
> > 
> >        is a GNU extension used by glibc (since 2.0), and must be
> >        regarded  as  obsolete in view of SUSv3.  The GNU version
> >        may, but need not, use the user-supplied buffer.   If  it
> >        does,  the  result  may be truncated in case the supplied
> >        buffer is too small. The result is always NUL-terminated.
> > 
> > Does the Debian page not have all of this information?
> 
>   I missed that.  IMO, though, since this is evidently the
> default form of strerror on Debian (all GNU?) systems, it should
> be listed at the top of the manpage, not tucked away in a postscript.

I regard that as debatable.  Arguably, it is the standard API that
should be primarily documented, and the Linux/glibc deviation 
provided as a supplementary note.  At least that is the way I 
lean on this issue.

The main problem, which was the missing _XOPEN_SOURCE in the
prototype is at least now fixed.

Cheers,

Michael

-- 
Michael Kerrisk
maintainer of Linux man pages Sections 2, 3, 4, 5, and 7 

Want to help with man page maintenance?  Grab the latest
tarball at ftp://ftp.win.tue.nl/pub/linux-local/manpages/
and grep the source files for 'FIXME'.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to