From ad30d568d6b1342f08b24aac1b3236958e402441 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Mon, 13 Jul 2020 13:25:18 +0200 Subject: [PATCH] do not use localtime result after other functions --- src/fe-common/core/fe-windows.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fe-common/core/fe-windows.c b/src/fe-common/core/fe-windows.c index 88fc0711..d575813d 100644 --- a/src/fe-common/core/fe-windows.c +++ b/src/fe-common/core/fe-windows.c @@ -679,10 +679,11 @@ static void sig_server_disconnected(SERVER_REC *server) } } -static void window_print_daychange(WINDOW_REC *window, struct tm *tm) +static void window_print_daychange(WINDOW_REC *window, time_t t) { THEME_REC *theme; TEXT_DEST_REC dest; + struct tm *tm; char *format, str[256]; int ret; @@ -690,6 +691,7 @@ static void window_print_daychange(WINDOW_REC *window, struct tm *tm) format_create_dest(&dest, NULL, NULL, MSGLEVEL_NEVER, window); format = format_get_text_theme(theme, MODULE_NAME, &dest, TXT_DAYCHANGE); + tm = localtime(&t); ret = strftime(str, sizeof(str), format, tm); g_free(format); if (ret <= 0) return; @@ -770,7 +772,7 @@ static void sig_print_text(void) /* day changed, print notice about it to every window */ for (tmp = windows; tmp != NULL; tmp = tmp->next) - window_print_daychange(tmp->data, tm); + window_print_daychange(tmp->data, t); } static int sig_check_daychange(void)