chiark / gitweb /
locale: unset locale vars that are not set any longer
authorLennart Poettering <lennart@poettering.net>
Mon, 20 Sep 2010 23:40:34 +0000 (01:40 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 20 Sep 2010 23:40:34 +0000 (01:40 +0200)
src/locale-setup.c

index ae75298..8ead9fd 100644 (file)
@@ -166,15 +166,15 @@ int locale_setup(void) {
 
         for (i = 0; i < _VARIABLE_MAX; i++) {
 
-                if (!variables[i])
-                        continue;
-
-                if (setenv(variable_names[i], variables[i], 1) < 0) {
-                        r = -errno;
-                        goto finish;
-                }
-
+                if (variables[i]) {
+                        if (setenv(variable_names[i], variables[i], 1) < 0) {
+                                r = -errno;
+                                goto finish;
+                        }
+                } else
+                        unsetenv(variable_names[i]);
         }
+
         r = 0;
 
 finish: