nuttx/libs/libc/time
ligd 0ce2d3f59a libs/libc/time: fix syslog recursion in gmtsub timezone loading
Set g_gmt_isset before calling gmtload() to prevent infinite recursion.

When CONFIG_SYSLOG_TIMESTAMP is enabled, syslog calls gmtime_r() to
format timestamps. gmtime_r() -> gmtsub() -> gmtload() -> tzload()
tries to open the timezone file. If the file doesn't exist on romfs,
romfs_open() calls ferr() which expands to syslog(), causing infinite
recursion since g_gmt_isset is still 0.

By setting g_gmt_isset = 1 before gmtload(), any recursive syslog
call during timezone loading will skip the gmtload path and use the
partially initialized state for timesub(), avoiding stack overflow.

Signed-off-by: ligd <liguiding1@xiaomi.com>
2026-04-21 01:36:01 +08:00
..
CMakeLists.txt Merge branch 'master' into vela 2026-04-21 01:12:27 +08:00
Kconfig nuttx:The default value of the boolean type config does not need to be enclosed in quotes. 2026-04-21 01:32:56 +08:00
Make.defs Merge branch 'master' into vela 2026-04-21 01:12:27 +08:00
lib_asctime.c tls: split tls.h to tls.h and tls_task.h 2026-04-21 01:35:03 +08:00
lib_asctimer.c Merge branch 'master' into vela 2026-04-21 01:12:27 +08:00
lib_calendar2utc.c Merge branch 'master' into vela 2026-04-21 01:12:27 +08:00
lib_ctime.c Merge branch 'master' into vela 2026-04-21 01:12:27 +08:00
lib_ctimer.c Merge branch 'master' into vela 2026-04-21 01:12:27 +08:00
lib_dayofweek.c Merge branch 'master' into vela 2026-04-21 01:12:27 +08:00
lib_daysbeforemonth.c sched: Correct word spelling mistakes. 2026-04-21 01:22:52 +08:00
lib_difftime.c Fix PSE52 difftime function error caused by data type conversion. 2026-04-21 01:29:27 +08:00
lib_gethrtime.c Merge branch 'master' into vela 2026-04-21 01:12:27 +08:00
lib_gettimeofday.c Merge branch 'master' into vela 2026-04-21 01:12:27 +08:00
lib_gmtime.c tls: split tls.h to tls.h and tls_task.h 2026-04-21 01:35:03 +08:00
lib_gmtimer.c Merge branch 'master' into vela 2026-04-21 01:12:27 +08:00
lib_isleapyear.c Merge branch 'master' into vela 2026-04-21 01:12:27 +08:00
lib_localtime.c libs/libc/time: fix syslog recursion in gmtsub timezone loading 2026-04-21 01:36:01 +08:00
lib_nanosleep.c Merge branch 'master' into vela 2026-04-21 01:12:27 +08:00
lib_settimeofday.c Merge branch 'master' into vela 2026-04-21 01:12:27 +08:00
lib_strftime.c Remove two redundant len=0 assignments. 2026-04-21 01:29:36 +08:00
lib_strptime.c Merge branch 'master' into vela 2026-04-21 01:12:27 +08:00
lib_time.c Merge branch 'master' into vela 2026-04-21 01:12:27 +08:00
lib_timegm.c Merge branch 'master' into vela 2026-04-21 01:12:27 +08:00
lib_timespec_get.c Merge branch 'master' into vela 2026-04-21 01:12:27 +08:00