summaryrefslogtreecommitdiff
path: root/src/core/wee-hook.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-11-27 11:48:35 +0100
committerSebastien Helleu <flashcode@flashtux.org>2011-11-27 11:48:35 +0100
commit41b5ef1e4cc6a28bd7274a016d83c95a93656248 (patch)
treea3df43ccbe1498745e84c6ccdc4f8db20e153f02 /src/core/wee-hook.c
parent8ba8e625800462b060bc9e0cfc73dd05059c1f59 (diff)
downloadweechat-41b5ef1e4cc6a28bd7274a016d83c95a93656248.zip
core: check pointer returned by function localtime
Diffstat (limited to 'src/core/wee-hook.c')
-rw-r--r--src/core/wee-hook.c16
1 files changed, 12 insertions, 4 deletions
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);