commit 53a05e3562a0c27b2ab1240c5ba55d7da87d3c75
parent fe817dc355d52f6842f3d73f81bd5c8129f94604
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 8 Oct 2018 19:22:35 +0200
sfeed_mbox: remove an unneeded strlcpy call
Diffstat:
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/sfeed_mbox.c b/sfeed_mbox.c
@@ -86,16 +86,17 @@ printfeed(FILE *fp, const char *feedname)
parsedtime = 0;
if (strtotime(fields[FieldUnixTimestamp], &parsedtime))
continue;
- /* can't convert: default to formatted time for time_t 0. */
- if (!gmtime_r(&parsedtime, &tm) ||
- !strftime(timebuf, sizeof(timebuf),
- "%a, %d %b %Y %H:%M:%S +0000", &tm))
- strlcpy(timebuf, "Thu, 01 Jan 1970 00:00:00 +0000",
- sizeof(timebuf));
/* mbox + mail header */
printf("From MAILER-DAEMON %s\n", mtimebuf);
- printf("Date: %s\n", timebuf);
+ /* can't convert: default to formatted time for time_t 0. */
+ if (gmtime_r(&parsedtime, &tm) &&
+ strftime(timebuf, sizeof(timebuf),
+ "%a, %d %b %Y %H:%M:%S +0000", &tm))
+ printf("Date: %s\n", timebuf);
+ else
+ printf("Date: Thu, 01 Jan 1970 00:00:00 +0000\n");
+
printf("From: %s <sfeed@>\n", fields[FieldAuthor][0] ? fields[FieldAuthor] : "unknown");
printf("To: %s <%s@%s>\n", user, user, host);
if (feedname[0])