Bug 118793 - strerror_r prototype inconsistency
strerror_r prototype inconsistency
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
1
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-03-20 07:47 EST by Nigel Horne
Modified: 2007-11-30 17:10 EST (History)
3 users (show)

See Also:
Fixed In Version: 2.3.3-27
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-05-27 08:31:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Nigel Horne 2004-03-20 07:47:57 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.4.1)
Gecko/20031114

Description of problem:
The prototype for strerror_r given in the manual page and the one
appearing in /usr/include/string.h don't agree.

man strerror_r gives:

int strerror_r(int errnum, char *buf, size_t n);

whereas 'fgrep strerror_r /usr/include/*' gives:

/usr/include/string.h:extern char *strerror_r (int __errnum, char
*__buf, size_t __buflen) __THROW;

So, does strerror_r return an int or a char *?

Version-Release number of selected component (if applicable):
glibc-2.3.2-101.4

How reproducible:
Always

Steps to Reproduce:
1. man strerror_r
2. fgrep strerror_r /usr/include/*
3.
    

Actual Results:  Prototypes differ

Expected Results:  Prototypes should agree

Additional info:

None
Comment 1 Jakub Jelinek 2004-03-20 08:17:20 EST
glibc strerror_r returns char * (and uses the buffer only for some
errors, for others it doesn't modify the buffer at all and just
returns a string literal (and has behaved this way at least since
1993).  It seems Unix 2003 recently added strerror_r with conflicting
prototype and behaviour (there has been no strerror_r in Unix 98)
and seems the man page describes Unix 2003 behaviour (while info strerror_r
describes the glibc behaviour).
I think glibc probably needs to change to match Unix 2003 and keep
compatibility via symbol versioning, but am not sure how many programs
will be broken by that change.
Comment 2 Jakub Jelinek 2004-05-27 08:31:36 EDT
In FC2 glibc (2.3.3-27), if you build with -D_XOPEN_SOURCE=600 or -D_POSIX_SOURCE=200112L,
strerror_r returning int will be used, otherwise the GNU variant.

Note You need to log in before you can comment on or make changes to this bug.