Module Name: src
Committed By: christos
Date: Mon Apr 19 17:49:28 UTC 2021
Modified Files:
src/usr.bin/mail: format.c
Log Message:
Fix weekday parsing; only reset the string when parsing fail and only set
the weekday when parsing succeeds (Steffen Nurpmeso)
To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/mail/format.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/mail/format.c
diff -u src/usr.bin/mail/format.c:1.15 src/usr.bin/mail/format.c:1.16
--- src/usr.bin/mail/format.c:1.15 Sat Apr 11 10:22:32 2009
+++ src/usr.bin/mail/format.c Mon Apr 19 13:49:28 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: format.c,v 1.15 2009/04/11 14:22:32 christos Exp $ */
+/* $NetBSD: format.c,v 1.16 2021/04/19 17:49:28 christos Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef __lint__
-__RCSID("$NetBSD: format.c,v 1.15 2009/04/11 14:22:32 christos Exp $");
+__RCSID("$NetBSD: format.c,v 1.16 2021/04/19 17:49:28 christos Exp $");
#endif /* not __lint__ */
#include <time.h>
@@ -579,10 +579,10 @@ date_to_tm(char *date, struct tm *tm)
*/
/* Check for an optional 'day-of-week' */
- if ((tail = strptime(date, " %a,", &tmp_tm)) == NULL) {
+ if ((tail = strptime(date, " %a,", &tmp_tm)) == NULL)
tail = date;
+ else
tm->tm_wday = tmp_tm.tm_wday;
- }
/* Get the required 'day' and 'month' */
if ((tail = strptime(tail, " %d %b", &tmp_tm)) == NULL)