]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
locale-setup: make failure in stat() critical
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 13 Dec 2022 09:02:57 +0000 (18:02 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 14 Dec 2022 11:18:58 +0000 (20:18 +0900)
The file was created by this function. Hence, the failure is something
critical.

src/shared/locale-setup.c

index 1b85ec41358aaf78109130298ea4173cb53f583b..cd994cffb7da7fdfd0d5340f4fe275384b8e8c92 100644 (file)
@@ -208,8 +208,10 @@ int locale_context_save(LocaleContext *c, char ***ret_set, char ***ret_unset) {
         if (r < 0)
                 return r;
 
-        if (stat("/etc/locale.conf", &st) >= 0)
-                c->mtime = timespec_load(&st.st_mtim);
+        if (stat("/etc/locale.conf", &st) < 0)
+                return -errno;
+
+        c->mtime = timespec_load(&st.st_mtim);
 
         if (ret_set)
                 *ret_set = TAKE_PTR(set);