提交 acf6989c 编写于 作者: zzuli_lyw's avatar zzuli_lyw

Fix setlocale return value

Issue: https://gitee.com/openharmony/third_party_musl/issues/I7JK2Z

test: libc-test
Signed-off-by: zzuli_lyw's avatarzzulilyw <378305181@qq.com>
上级 f8ab2f96
...@@ -9,8 +9,8 @@ static char buf[LC_ALL*(LOCALE_NAME_MAX+1)]; ...@@ -9,8 +9,8 @@ static char buf[LC_ALL*(LOCALE_NAME_MAX+1)];
static inline int Fresh(struct __locale_map *lm) static inline int Fresh(struct __locale_map *lm)
{ {
if (lm != NULL && lm->flag == INVALID) { if (lm != NULL) {
return INVALID; return lm->flag;
} }
return VALID; return VALID;
} }
...@@ -46,7 +46,9 @@ char *setlocale(int cat, const char *name) ...@@ -46,7 +46,9 @@ char *setlocale(int cat, const char *name)
UNLOCK(__locale_lock); UNLOCK(__locale_lock);
return 0; return 0;
} }
flag = Fresh(lm); if(Fresh(lm) == INVALID) {
flag = INVALID;
}
tmp_locale.cat[i] = lm; tmp_locale.cat[i] = lm;
} }
libc.global_locale = tmp_locale; libc.global_locale = tmp_locale;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册