From ef63547e955edc60e2d074ef825b091e1c43882e Mon Sep 17 00:00:00 2001 From: Tom Keiser Date: Wed, 1 Feb 2012 03:31:23 -0500 Subject: [PATCH] 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... Change-Id: I333745fb0a16e5bc9adb0755591d80de010d4d31 Reviewed-on: http://gerrit.openafs.org/6638 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/comerr/error_msg.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/comerr/error_msg.c b/src/comerr/error_msg.c index e09cce3b51..071436065e 100644 --- a/src/comerr/error_msg.c +++ b/src/comerr/error_msg.c @@ -154,12 +154,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; }