]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
locale-setup: clear partially loaded context on failure
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 13 Dec 2022 09:01:36 +0000 (18:01 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 14 Dec 2022 11:18:58 +0000 (20:18 +0900)
src/shared/locale-setup.c

index 4b0d46995bac35507d87511532ded0a2aab9e6b6..1b85ec41358aaf78109130298ea4173cb53f583b 100644 (file)
@@ -135,13 +135,10 @@ int locale_context_load(LocaleContext *c, LocaleLoadFlag flag) {
         r = locale_context_load_env(c, flag);
 
 finalize:
-        if (r < 0)
-                return r;
-
-        if (r == 0) {
-                /* Nothing loaded. */
+        if (r <= 0) {
+                /* Nothing loaded, or error. */
                 locale_context_clear(c);
-                return 0;
+                return r;
         }
 
         if (FLAGS_SET(flag, LOCALE_LOAD_SIMPLIFY))