]> arthur.barton.de Git - netdata.git/blobdiff - src/main.c
Merge pull request #1854 from ktsaou/master
[netdata.git] / src / main.c
index 8c157efa38f37f8be81fc52022fee8d3410ed967..86bd8604be39ba7b6687ed584f4ab88760e5e01c 100644 (file)
@@ -378,7 +378,7 @@ static void backwards_compatible_config() {
     config_move(CONFIG_SECTION_GLOBAL, "default port",
                 CONFIG_SECTION_WEB,    "default port");
 
-    config_move(CONFIG_SECTION_GLOBAL, "disconnect idle clients after seconds",
+    config_move(CONFIG_SECTION_GLOBAL, "disconnect idle web clients after seconds",
                 CONFIG_SECTION_WEB,    "disconnect idle clients after seconds");
 
     config_move(CONFIG_SECTION_GLOBAL, "respect web browser do not track policy",
@@ -513,6 +513,9 @@ void set_global_environment() {
 
     // disable buffering for python plugins
     setenv("PYTHONUNBUFFERED", "1", 1);
+
+    // switch to standard locale for plugins
+    setenv("LC_ALL", "C", 1);
 }
 
 int main(int argc, char **argv) {
@@ -851,7 +854,13 @@ int main(int argc, char **argv) {
         // get the user we should run
 
         // IMPORTANT: this is required before web_files_uid()
-        user = config_get(CONFIG_SECTION_GLOBAL, "run as user"    , (getuid() == 0)?NETDATA_USER:"");
+        if(getuid() == 0) {
+            user = config_get(CONFIG_SECTION_GLOBAL, "run as user", NETDATA_USER);
+        }
+        else {
+            struct passwd *passwd = getpwuid(getuid());
+            user = config_get(CONFIG_SECTION_GLOBAL, "run as user", (passwd && passwd->pw_name)?passwd->pw_name:"");
+        }
 
         // IMPORTANT: these have to run once, while single threaded
         web_files_uid(); // IMPORTANT: web_files_uid() before web_files_gid()