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 ae7529801b9510dd7c7c18add984d3aa08d505a0..8ead9fdd9d27891835188dfd3dee491e2eac4648 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: