libc/time: Update g_lcl_tzname only after the success
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: I0117c5b43bee3affb36d118e0b97f6dd7137080b
This commit is contained in:
parent
26908f472e
commit
dcad420127
@ -2532,19 +2532,12 @@ void tzset(void)
|
||||
goto out;
|
||||
}
|
||||
|
||||
g_lcl_isset = strlen(name) < sizeof g_lcl_tzname;
|
||||
if (g_lcl_isset)
|
||||
{
|
||||
strcpy(g_lcl_tzname, name);
|
||||
}
|
||||
|
||||
if (lclptr == NULL)
|
||||
{
|
||||
lclptr = lib_malloc(sizeof *lclptr);
|
||||
if (lclptr == NULL)
|
||||
{
|
||||
settzname(); /* all we can do */
|
||||
goto out;
|
||||
goto tzname;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2565,11 +2558,18 @@ void tzset(void)
|
||||
if (name[0] == ':' || tzparse(name, lclptr, FALSE) != 0)
|
||||
{
|
||||
gmtload(lclptr);
|
||||
goto tzname;
|
||||
}
|
||||
}
|
||||
|
||||
settzname();
|
||||
g_lcl_isset = strlen(name) < sizeof g_lcl_tzname;
|
||||
if (g_lcl_isset)
|
||||
{
|
||||
strcpy(g_lcl_tzname, name);
|
||||
}
|
||||
|
||||
tzname:
|
||||
settzname();
|
||||
out:
|
||||
tz_semgive(&g_lcl_sem);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user