From: VMware, Inc <> Date: Tue, 28 Jun 2011 18:32:46 +0000 (-0700) Subject: Changes in shared code that don't affect open-vm-tools functionality. X-Git-Tag: 2011.06.27-437995~38 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=37558e3b5f03c7b36b7f2eb73b36fd179d99a2ea;p=thirdparty%2Fopen-vm-tools.git Changes in shared code that don't affect open-vm-tools functionality. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/err/errPosix.c b/open-vm-tools/lib/err/errPosix.c index be5cfb973..73302a8cb 100644 --- a/open-vm-tools/lib/err/errPosix.c +++ b/open-vm-tools/lib/err/errPosix.c @@ -23,6 +23,11 @@ * */ +#if defined __linux__ +/* Force GNU strerror_r prototype instead of Posix prototype */ +# define _GNU_SOURCE +#endif + #include #include #include @@ -66,54 +71,3 @@ ErrErrno2String(Err_Number errorNumber, // IN ASSERT(p != NULL); return p; } - - -/* - *---------------------------------------------------------------------- - * - * Err_Errno2LocalString -- - * - * Returns a localized string in UTF-8 that corresponds to the - * passed error number. - * - * XXX doesn't actually work - * - * Results: - * Allocated error message string, caller must free. - * NULL on failure. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -char * -Err_Errno2LocalString(Err_Number errorNumber) // IN -{ - /* - * XXX The version of glibc (2.2.x) we use doesn't support - * uselocal() or strerror_l(), and we can't set LC_MESSAGES - * globally, so we can't implement this function. - * Instead, we return NULL and the upper level code - * (Msg_LocalizeList1) generates some sort of message. - * We can't do that here because it would require using - * Msg_Format, which is a layer violation (and a linking - * problem). - */ - -#if 0 - // XXX need to cache newLocale if we ever actually use this code - locale_t newLocale = newlocale(1 << LC_MESSAGES, NULL, NULL); - locale_t oldLocale = uselocale(newLocale); - char buf[2048]; - char *p; - - p = strerror_r(errorNumber, buf, sizeof buf); - ASSERT_NOT_IMPLEMENTED(p != NULL); - uselocale(oldLocale); - return Util_SafeStrdup(p); -#else - return NULL; -#endif -} diff --git a/open-vm-tools/lib/include/err.h b/open-vm-tools/lib/include/err.h index 0a9f6f020..5614c5ef4 100644 --- a/open-vm-tools/lib/include/err.h +++ b/open-vm-tools/lib/include/err.h @@ -56,8 +56,9 @@ Err_Number Err_String2Errno(const char *string); Err_Number Err_String2ErrnoDebug(const char *string); #endif -char *Err_Errno2LocalString(Err_Number errorNumber); - +#if defined(_WIN32) +char *Err_SanitizeMessage(const char *msg); +#endif /* *----------------------------------------------------------------------