From: Yu Watanabe Date: Tue, 13 Dec 2022 09:02:57 +0000 (+0900) Subject: locale-setup: make failure in stat() critical X-Git-Tag: v253-rc1~266^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=00afa6a38fbd05f79ffc1b1365ad68f63e7ac335;p=thirdparty%2Fsystemd.git locale-setup: make failure in stat() critical The file was created by this function. Hence, the failure is something critical. --- diff --git a/src/shared/locale-setup.c b/src/shared/locale-setup.c index 1b85ec41358..cd994cffb7d 100644 --- a/src/shared/locale-setup.c +++ b/src/shared/locale-setup.c @@ -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);