diff --git a/porting/linux/user/src/locale/setlocale.c b/porting/linux/user/src/locale/setlocale.c index 2ebbbdc9b392175ea5fa52024e103c9b5872900d..04a22d83aedd67f3403b7235da387c83ab4c4c58 100644 --- a/porting/linux/user/src/locale/setlocale.c +++ b/porting/linux/user/src/locale/setlocale.c @@ -9,8 +9,8 @@ static char buf[LC_ALL*(LOCALE_NAME_MAX+1)]; static inline int Fresh(struct __locale_map *lm) { - if (lm != NULL && lm->flag == INVALID) { - return INVALID; + if (lm != NULL) { + return lm->flag; } return VALID; } @@ -46,7 +46,9 @@ char *setlocale(int cat, const char *name) UNLOCK(__locale_lock); return 0; } - flag = Fresh(lm); + if(Fresh(lm) == INVALID) { + flag = INVALID; + } tmp_locale.cat[i] = lm; } libc.global_locale = tmp_locale;