From: Florian Forster Date: Mon, 30 Nov 2015 19:27:24 +0000 (+0100) Subject: Set locale environment variables at startup. X-Git-Tag: collectd-5.5.1~43 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f89012e915b0aa0a3c65655ea156904799174299;p=collectd.git Set locale environment variables at startup. Fixes: #1237 --- diff --git a/src/daemon/collectd.c b/src/daemon/collectd.c index 88c38ace..ad069992 100644 --- a/src/daemon/collectd.c +++ b/src/daemon/collectd.c @@ -302,6 +302,11 @@ static int do_init (void) #if HAVE_SETLOCALE if (setlocale (LC_NUMERIC, COLLECTD_LOCALE) == NULL) WARNING ("setlocale (\"%s\") failed.", COLLECTD_LOCALE); + + /* Update the environment, so that libraries that are calling + * setlocale(LC_NUMERIC, "") don't accidentally revert these changes. */ + unsetenv ("LC_ALL"); + setenv ("LC_NUMERIC", COLLECTD_LOCALE, /* overwrite = */ 1); #endif #if HAVE_LIBKSTAT