provide __xpg_strerror_r
Eric Blake
eblake@redhat.com
Thu Feb 10 00:21:00 GMT 2011
On 02/06/2011 02:54 AM, Corinna Vinschen wrote:
>> We already provide our own strerror() (it provides a better experience
>> for out-of-range values that the newlib interface), but we're currently
>> using the newlib strerror_r() (in spite of its truncation flaw).
>>
>> How should I rework this patch?
>
> It would be better if we implement strerror_r locally, in two versions,
> just as on Linux. I think the best approach is to implement this in
> newlib first (I replied to your mail there) and then, given that we use
> the newlib string.h, copy the method over to Cygwin to match our current
> strerror more closely.
Here's the cygwin side of things, to match newlib's <string.h> changes.
Surprisingly, strerror_r turned out to be identical even when based on
different root strerror(), so I left that inside #if 0, but it's easy
enough to kill the #if 0 if you don't want cygwin to use any of newlib's
strerror*.
---
winsup/cygwin/ChangeLog | 9 +++
winsup/cygwin/cygwin.din | 1 +
winsup/cygwin/errno.cc | 84
+++++++++++++++++++++-----------
winsup/cygwin/include/cygwin/version.h | 3 +-
4 files changed, 68 insertions(+), 29 deletions(-)
2011-02-09 Eric Blake <eblake@redhat.com>
* errno.cc (__xpg_strerror_r): New function.
(strerror_r): Update comments to match newlib's fixes.
(strerror): Set errno on failure.
(_sys_errlist): Cause EINVAL failure for reserved values.
* cygwin.din: Export new function.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
--
Eric Blake eblake@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygwin.patch40
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20110210/e8d195bb/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20110210/e8d195bb/attachment.sig>
More information about the Cygwin-patches
mailing list