From: Tom Keiser Date: Wed, 1 Feb 2012 08:31:23 +0000 (-0500) Subject: com_err: correctly deal with lack of libintl X-Git-Tag: upstream/1.6.1.pre4^2~71 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=c0184656b65ee53f29fa0d4b62ec789de4d96e79;p=packages%2Fo%2Fopenafs.git com_err: correctly deal with lack of libintl On machines lacking a libintl, _intlize() currently fails to initialize the output error string--leading to tools (e.g., translate_et) returning a null string; make afs_com_err fall back to returning the en/US canonical error text when we don't have any i18n support... Reviewed-on: http://gerrit.openafs.org/6638 Tested-by: BuildBot Reviewed-by: Derrick Brashear (cherry picked from commit ef63547e955edc60e2d074ef825b091e1c43882e) Change-Id: Id138e48826aa855bd87e47f201ed6840399aa640 Reviewed-on: http://gerrit.openafs.org/6752 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/comerr/error_msg.c b/src/comerr/error_msg.c index eae3204f5..1f698a7c0 100644 --- a/src/comerr/error_msg.c +++ b/src/comerr/error_msg.c @@ -153,12 +153,16 @@ _intlize(const char *msg, int base, char *str, size_t len) static_inline const char * _intlize(const char *msg, int base, char *str, size_t len) { +#if defined(HAVE_LIBINTL) char domain[12 +20]; +#endif if (!str) return msg; - snprintf(domain, sizeof(domain), "heim_com_err%d", base); #if defined(HAVE_LIBINTL) + snprintf(domain, sizeof(domain), "heim_com_err%d", base); strlcpy(str, dgettext(domain, msg), len); +#else + strlcpy(str, msg, len); #endif return str; }