mirror of
https://github.com/weechat/weechat.git
synced 2026-06-29 14:26:39 +02:00
core, plugins: check return code of strftime function
This commit is contained in:
@@ -994,9 +994,10 @@ config_get_item_time (char *text_time, int max_length)
|
||||
|
||||
date = time (NULL);
|
||||
local_time = localtime (&date);
|
||||
strftime (text_time, max_length,
|
||||
config_item_time_evaluated,
|
||||
local_time);
|
||||
if (strftime (text_time, max_length,
|
||||
config_item_time_evaluated,
|
||||
local_time) == 0)
|
||||
text_time[0] = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1281,7 +1282,8 @@ config_day_change_timer_cb (const void *pointer, void *data,
|
||||
}
|
||||
|
||||
/* send signal "day_changed" */
|
||||
strftime (str_time, sizeof (str_time), "%Y-%m-%d", local_time);
|
||||
if (strftime (str_time, sizeof (str_time), "%Y-%m-%d", local_time) == 0)
|
||||
str_time[0] = '\0';
|
||||
(void) hook_signal_send ("day_changed",
|
||||
WEECHAT_HOOK_SIGNAL_STRING, str_time);
|
||||
}
|
||||
|
||||
+6
-4
@@ -4804,8 +4804,9 @@ hook_print_log ()
|
||||
local_time = localtime (&seconds);
|
||||
if (local_time)
|
||||
{
|
||||
strftime (text_time, sizeof (text_time),
|
||||
"%d/%m/%Y %H:%M:%S", local_time);
|
||||
if (strftime (text_time, sizeof (text_time),
|
||||
"%d/%m/%Y %H:%M:%S", local_time) == 0)
|
||||
text_time[0] = '\0';
|
||||
}
|
||||
log_printf (" last_exec.tv_sec. . . : %lld (%s)",
|
||||
(long long)(HOOK_TIMER(ptr_hook, last_exec.tv_sec)),
|
||||
@@ -4816,8 +4817,9 @@ hook_print_log ()
|
||||
local_time = localtime (&seconds);
|
||||
if (local_time)
|
||||
{
|
||||
strftime (text_time, sizeof (text_time),
|
||||
"%d/%m/%Y %H:%M:%S", local_time);
|
||||
if (strftime (text_time, sizeof (text_time),
|
||||
"%d/%m/%Y %H:%M:%S", local_time) == 0)
|
||||
text_time[0] = '\0';
|
||||
}
|
||||
log_printf (" next_exec.tv_sec. . . : %lld (%s)",
|
||||
(long long)(HOOK_TIMER(ptr_hook, next_exec.tv_sec)),
|
||||
|
||||
+3
-2
@@ -316,8 +316,9 @@ util_get_time_string (const time_t *date)
|
||||
local_time = localtime (date);
|
||||
if (local_time)
|
||||
{
|
||||
strftime (text_time, sizeof (text_time),
|
||||
CONFIG_STRING(config_look_time_format), local_time);
|
||||
if (strftime (text_time, sizeof (text_time),
|
||||
CONFIG_STRING(config_look_time_format), local_time) == 0)
|
||||
text_time[0] = '\0';
|
||||
}
|
||||
|
||||
return text_time;
|
||||
|
||||
Reference in New Issue
Block a user