Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/mail Fix weekday parsing; only reset the string when...



details:   https://anonhg.NetBSD.org/src/rev/4aa909e1af10
branches:  trunk
changeset: 1020670:4aa909e1af10
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Apr 19 17:49:28 2021 +0000

description:
Fix weekday parsing; only reset the string when parsing fail and only set
the weekday when parsing succeeds (Steffen Nurpmeso)

diffstat:

 usr.bin/mail/format.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r 090a6f7f3a5e -r 4aa909e1af10 usr.bin/mail/format.c
--- a/usr.bin/mail/format.c     Mon Apr 19 16:35:11 2021 +0000
+++ b/usr.bin/mail/format.c     Mon Apr 19 17:49:28 2021 +0000
@@ -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 @@
         */
 
        /* 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)



Home | Main Index | Thread Index | Old Index