1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-30 14:56:39 +02:00

core, plugins: check return code of strftime function

This commit is contained in:
Sébastien Helleu
2017-09-22 21:50:01 +02:00
parent ae66a4d8a5
commit 5aab494dd6
23 changed files with 130 additions and 72 deletions
+4 -2
View File
@@ -726,7 +726,8 @@ relay_irc_get_line_info (struct t_relay_client *client,
&& time_format && time_format[0])
{
tm = localtime (&msg_date);
strftime (str_time, sizeof (str_time), time_format, tm);
if (strftime (str_time, sizeof (str_time), time_format, tm) == 0)
str_time[0] = '\0';
length = strlen (str_time) + strlen (pos) + 1;
*message = malloc (length);
if (*message)
@@ -741,7 +742,8 @@ relay_irc_get_line_info (struct t_relay_client *client,
&& (RELAY_IRC_DATA(client, server_capabilities) & (1 << RELAY_IRC_CAPAB_SERVER_TIME)))
{
tm = gmtime (&msg_date);
strftime (str_time, sizeof (str_time), "%Y-%m-%dT%H:%M:%S", tm);
if (strftime (str_time, sizeof (str_time), "%Y-%m-%dT%H:%M:%S", tm) == 0)
str_time[0] = '\0';
snprintf (str_tag, sizeof (str_tag), "@time=%s.000Z ", str_time);
*tags = strdup (str_tag);
}
+6 -4
View File
@@ -96,8 +96,9 @@ relay_buffer_refresh (const char *hotlist)
date_tmp = localtime (&(ptr_client->start_time));
if (date_tmp)
{
strftime (str_date_start, sizeof (str_date_start),
"%a, %d %b %Y %H:%M:%S", date_tmp);
if (strftime (str_date_start, sizeof (str_date_start),
"%a, %d %b %Y %H:%M:%S", date_tmp) == 0)
str_date_start[0] = '\0';
}
str_date_end[0] = '-';
str_date_end[1] = '\0';
@@ -106,8 +107,9 @@ relay_buffer_refresh (const char *hotlist)
date_tmp = localtime (&(ptr_client->end_time));
if (date_tmp)
{
strftime (str_date_end, sizeof (str_date_end),
"%a, %d %b %Y %H:%M:%S", date_tmp);
if (strftime (str_date_end, sizeof (str_date_end),
"%a, %d %b %Y %H:%M:%S", date_tmp) == 0)
str_date_end[0] = '\0';
}
}
+9 -6
View File
@@ -66,16 +66,18 @@ relay_command_client_list (int full)
date_tmp = localtime (&(ptr_client->start_time));
if (date_tmp)
{
strftime (date_start, sizeof (date_start),
"%a, %d %b %Y %H:%M:%S", date_tmp);
if (strftime (date_start, sizeof (date_start),
"%a, %d %b %Y %H:%M:%S", date_tmp) == 0)
date_start[0] = '\0';
}
date_activity[0] = '\0';
date_tmp = localtime (&(ptr_client->last_activity));
if (date_tmp)
{
strftime (date_activity, sizeof (date_activity),
"%a, %d %b %Y %H:%M:%S", date_tmp);
if (strftime (date_activity, sizeof (date_activity),
"%a, %d %b %Y %H:%M:%S", date_tmp) == 0)
date_activity[0] = '\0';
}
if (full)
@@ -156,8 +158,9 @@ relay_command_server_list ()
date_tmp = localtime (&(ptr_server->start_time));
if (date_tmp)
{
strftime (date_start, sizeof (date_start),
"%a, %d %b %Y %H:%M:%S", date_tmp);
if (strftime (date_start, sizeof (date_start),
"%a, %d %b %Y %H:%M:%S", date_tmp) == 0)
date_start[0] = '\0';
}
weechat_printf (
NULL,