summary refs log tree commit diff stats
path: root/src/common/text.c
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2013-11-02 02:05:55 -0400
committerTingPing <tingping@tingping.se>2013-11-02 21:07:03 -0400
commitaf248ce2c17416ed33e9feb3d248347ee86f02e4 (patch)
tree26b7f1b9bf44c727049ffc58c7b16c51decb2626 /src/common/text.c
parent7e6f37b4cd68a520e808ac642a2750d5d60c0aa8 (diff)
Fix invalid timestamps crashing on Windows
Diffstat (limited to 'src/common/text.c')
-rw-r--r--src/common/text.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/common/text.c b/src/common/text.c
index 0b66c5fd..58d3b45c 100644
--- a/src/common/text.c
+++ b/src/common/text.c
@@ -542,7 +542,7 @@ log_create_pathname (char *servname, char *channame, char *netname)
 	/* insert time/date */
 	now = time (NULL);
 	tm = localtime (&now);
-	strftime (fnametime, sizeof (fnametime), fname, tm);
+	strftime_validated (fnametime, sizeof (fnametime), fname, tm);
 
 	/* create final path/filename */
 	if (logmask_is_fullpath ())
@@ -649,14 +649,7 @@ get_stamp_str (char *fmt, time_t tim, char **ret)
 			fmt = loc;
 	}
 
-	len = strftime (dest, sizeof (dest), fmt, localtime (&tim));
-#ifdef WIN32
-	if (!len)
-	{
-		/* use failsafe format until a correct one is specified */
-		len = strftime (dest, sizeof (dest), "[%H:%M:%S]", localtime (&tim));
-	}
-#endif
+	len = strftime_validated (dest, sizeof (dest), fmt, localtime (&tim));
 	if (len)
 	{
 		if (prefs.utf8_locale)