From: Yu Watanabe Date: Tue, 13 Dec 2022 09:01:36 +0000 (+0900) Subject: locale-setup: clear partially loaded context on failure X-Git-Tag: v253-rc1~266^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50359113e9fa9c48731efa7dbd725fe11b22cab0;p=thirdparty%2Fsystemd.git locale-setup: clear partially loaded context on failure --- diff --git a/src/shared/locale-setup.c b/src/shared/locale-setup.c index 4b0d46995ba..1b85ec41358 100644 --- a/src/shared/locale-setup.c +++ b/src/shared/locale-setup.c @@ -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))