This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bug in strerror_r


POSIX requires strerror_r to return an int: 0 for success, and an errno value failure.  Newlib currently returns char*, (the value of strerror), which is not permitted.  See http://www.opengroup.org/onlinepubs/009695399/functions/strerror_r.html.

I'm not sure if libc/sys/linux/dl has problems, since its Makefile.am includes AM_CFLAGS of -D__strerror_r=strerror_r, so that should also be visited.  Also, strerror in general is not required to be reentrant, but strerror_r is, so I am relying on the documentation of newlib's strerror being thread-safe since (with or without the patch) this implementation of strerror_r calls strerror.  Therefore, this patch may not be complete, but it is a start.

2005-03-17  Eric Blake  <ebb9@byu.net>

	* libc/string/strerror_r.c (strerror_r): Return int, not char*,
	as required by POSIX.
	* libc/include/string.h (strerror_r): Ditto.
	* libc/sys/linux/argp/argp-help.c (__argp_failure): Fix caller.

--
Eric Blake

Attachment: newlib.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]