This is the mail archive of the cygwin-patches mailing list for the Cygwin 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: provide __xpg_strerror_r


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

Attachment: cygwin.patch40
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]