[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: ldap_err2string format



Kurt@OpenLDAP.org wrote:

> >If an implementation returns a pointer to static,
> >readonly data or to thread specific data, ldap_err2string() should be
> >thread safe).
>
> strerror() is not thread safe because it allows the implementation
> to dynamically create the string in the static, readonly (to caller)
> space, e.g: "unknown error (666)".  Same would follow for
> ldap_err2string().

A thread-safe strerror() (or ldap_err2string()) would require that the
"static" string is store in thread-specific storage.

For strerror(), some platforms provide a strerror_r() that takes a buffer as
parameter, other platforms -- like HP/UX 11 -- use thread-specific storage.

I would have thought that the nature of the LDAP API would make using
thread-specific storage for ldap_err2string() somewhat attractive.  On the
other hand, I recently discovered that pthread_key_create() (which is what
is used to create this stuff) fails on AIX 4.2 and earlier... so perhaps
ldap_err2string() should simply take a buffer as an extra parameter.

jch
begin:vcard 
n:Haxby;John
tel;fax:+44 1344 763686
tel;work:+44 1344 763711
x-mozilla-html:FALSE
url:https://ecardfile.com/id/jch
org:Hewlett Packard;OpenMail R&D<img src="http://www.ice.hp.com/cyc/om/00/graphics/omlinux.jpg"; width=53 height=62 align=top>
adr:;;Nine Mile Ride;Wokingham;Berks;RG40 3LL;England
version:2.1
email;internet:john_haxby@hp.com
x-mozilla-cpt:;-11552
fn:John Haxby
end:vcard