From: Bruno Haible Date: Sun, 14 Oct 2007 16:07:02 +0000 (+0000) Subject: Save errno around tfind() call. X-Git-Tag: v0.17~129 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac5cb33d56dd4f44064d36a3912ae3d192e69732;p=thirdparty%2Fgettext.git Save errno around tfind() call. --- diff --git a/gettext-runtime/intl/ChangeLog b/gettext-runtime/intl/ChangeLog index 6cf933270..91012ed76 100644 --- a/gettext-runtime/intl/ChangeLog +++ b/gettext-runtime/intl/ChangeLog @@ -1,3 +1,9 @@ +2007-10-14 Bruno Haible + + * dcigettext.c (DCIGETTEXT): Save errno also around the tfind() call. + Needed because Interix 3.5 tfind() clobbers errno. + Reported by Martin Koeppe . + 2007-10-13 Bruno Haible * gettextP.h: Include or lock.h. @@ -4063,4 +4069,4 @@ Sun Jul 2 02:06:50 1995 Ulrich Drepper needed to internationalize own packages. It provides functions which allow to use the X/Open catgets function with an interface like the Uniforum gettext function. For system which does not - have neither of those a complete implementation is provided. + have neither of those a complete implementation is provided. \ No newline at end of file diff --git a/gettext-runtime/intl/dcigettext.c b/gettext-runtime/intl/dcigettext.c index b172bec27..087835c11 100644 --- a/gettext-runtime/intl/dcigettext.c +++ b/gettext-runtime/intl/dcigettext.c @@ -522,6 +522,9 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, : n == 1 ? (char *) msgid1 : (char *) msgid2); #endif + /* Preserve the `errno' value. */ + saved_errno = errno; + gl_rwlock_rdlock (_nl_state_lock); /* If DOMAINNAME is NULL, we are interested in the default domain. If @@ -592,13 +595,11 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, retval = (char *) (*foundp)->translation; gl_rwlock_unlock (_nl_state_lock); + errno = saved_errno; return retval; } #endif - /* Preserve the `errno' value. */ - saved_errno = errno; - /* See whether this is a SUID binary or not. */ DETERMINE_SECURE;