From f89012e915b0aa0a3c65655ea156904799174299 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 30 Nov 2015 20:27:24 +0100 Subject: [PATCH] Set locale environment variables at startup. Fixes: #1237 --- src/daemon/collectd.c | 5 +++++ 1 file changed, 5 insertions(+) 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 -- 2.30.2