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] |
On 02/06/2011 02:52 AM, Corinna Vinschen wrote: > First of all, the existing implementation follows glibc's lead, so > it should stick to the API but the behavior should be fixed. > > Other than that, the Linux approach would work best. Provide both > interfaces and use test macros. Fortunately they are documented in the > man page: > > The XSI-compliant version of strerror_r() is provided if: > (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE > Otherwise, the GNU-specific version is provided. > > Ideally we don't define _GNU_SOURCE by default, so this should result in > getting the POSIX version by default. Well, for backwards compatibility (as well as glibc compatibility), I thought it better we still get the _GNU_SOURCE version by default; but I can tweak things if you really want me to default to POSIX when no feature test macros are present. At any rate, here's the newlib side of the patch (cygwin will need to be patched separately). 2011-02-08 Eric Blake <eblake@redhat.com> * libc/include/string.h (strerror_r): Update declaration. * libc/string/strerror_r.c (strerror_r): Always return NUL-terminated string. * 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. --- newlib/ChangeLog | 10 ++++++++++ newlib/libc/include/string.h | 17 ++++++++++++++++- newlib/libc/string/Makefile.am | 3 ++- newlib/libc/string/Makefile.in | 14 +++++++++++--- newlib/libc/string/strerror_r.c | 26 +++++++++++++++++++++----- newlib/libc/string/xpg_strerror_r.c | 19 +++++++++++++++++++ 6 files changed, 79 insertions(+), 10 deletions(-) create mode 100644 newlib/libc/string/xpg_strerror_r.c -- 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] |