From 41b5ef1e4cc6a28bd7274a016d83c95a93656248 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sun, 27 Nov 2011 11:48:35 +0100 Subject: core: check pointer returned by function localtime --- src/core/wee-hook.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/core/wee-hook.c') diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c index 36773f4af..508fcefda 100644 --- a/src/core/wee-hook.c +++ b/src/core/wee-hook.c @@ -3752,16 +3752,24 @@ hook_print_log () log_printf (" interval. . . . . . . : %ld", HOOK_TIMER(ptr_hook, interval)); log_printf (" align_second. . . . . : %d", HOOK_TIMER(ptr_hook, align_second)); log_printf (" remaining_calls . . . : %d", HOOK_TIMER(ptr_hook, remaining_calls)); + text_time[0] = '\0'; local_time = localtime (&HOOK_TIMER(ptr_hook, last_exec).tv_sec); - strftime (text_time, sizeof (text_time), - "%d/%m/%Y %H:%M:%S", local_time); + if (local_time) + { + strftime (text_time, sizeof (text_time), + "%d/%m/%Y %H:%M:%S", local_time); + } log_printf (" last_exec.tv_sec. . . : %ld (%s)", HOOK_TIMER(ptr_hook, last_exec.tv_sec), text_time); log_printf (" last_exec.tv_usec . . : %ld", HOOK_TIMER(ptr_hook, last_exec.tv_usec)); + text_time[0] = '\0'; local_time = localtime (&HOOK_TIMER(ptr_hook, next_exec).tv_sec); - strftime (text_time, sizeof (text_time), - "%d/%m/%Y %H:%M:%S", local_time); + if (local_time) + { + strftime (text_time, sizeof (text_time), + "%d/%m/%Y %H:%M:%S", local_time); + } log_printf (" next_exec.tv_sec. . . : %ld (%s)", HOOK_TIMER(ptr_hook, next_exec.tv_sec), text_time); -- cgit v1.2.3