This is the mail archive of the newlib@sourceware.org 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]

Re: strerror_r questions


On 02/09/2011 03:43 PM, Eric Blake wrote:
>> Erm... shouldn't the return value be "int" rather than "char *" in this
>> case?
> 
> Oops, yes.  Will fix in v2.

Changes in v2: more documentation, fix the signature, change the default
when no feature macros are defined, don't overwrite buf if n is too
small, guarantee NUL termination in POSIX variant

> The "Unknown error XXX" message is a cygwin artifact, not a newlib
> artifact.  That is, cygwin should be using it's own strerror_r, since it
> provides its own strerror() with different behavior than newlib's.

Surprisingly, cygwin can continue to use newlib's strerror_r, but not
its __xpg_strerror_r.

---
 newlib/ChangeLog                    |   11 ++++++++
 newlib/libc/include/string.h        |   15 ++++++++++-
 newlib/libc/string/Makefile.am      |    3 +-
 newlib/libc/string/Makefile.in      |   14 ++++++++--
 newlib/libc/string/strerror.c       |   14 ++++++++++
 newlib/libc/string/strerror_r.c     |   46
++++++++++++++++++++++++++++------
 newlib/libc/string/xpg_strerror_r.c |   25 +++++++++++++++++++
 7 files changed, 115 insertions(+), 13 deletions(-)
 create mode 100644 newlib/libc/string/xpg_strerror_r.c

2011-02-09  Eric Blake  <eblake@redhat.com>

	* libc/include/string.h (strerror_r): Update declaration.
	* libc/string/strerror.c (strerror): Update documentation.
	* libc/string/strerror_r.c (strerror_r): Always return
	NUL-terminated string; don't overwrite too-short buf.
	* libc/string/xpg_strerror_r.c (__xpg_strerror_r): Implement
	POSIX variant.
	* libc/string/Makefile.am (GENERAL_SOURCES): Build new file.
	* libc/string/Makefile.in: Regenerate.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: newlib.patch48
Description: Text document

Attachment: signature.asc
Description: OpenPGP digital signature


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