Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/cvslatest Handle dummy timestamp better and check fo...



details:   https://anonhg.NetBSD.org/src/rev/06b7c7703706
branches:  trunk
changeset: 945669:06b7c7703706
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Nov 03 22:21:43 2020 +0000

description:
Handle dummy timestamp better and check for I/O errors. From khorben@

diffstat:

 usr.bin/cvslatest/cvslatest.c |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (46 lines):

diff -r 3e61b7586e52 -r 06b7c7703706 usr.bin/cvslatest/cvslatest.c
--- a/usr.bin/cvslatest/cvslatest.c     Tue Nov 03 22:08:44 2020 +0000
+++ b/usr.bin/cvslatest/cvslatest.c     Tue Nov 03 22:21:43 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cvslatest.c,v 1.8 2019/03/09 16:18:22 christos Exp $   */
+/*     $NetBSD: cvslatest.c,v 1.9 2020/11/03 22:21:43 christos Exp $   */
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: cvslatest.c,v 1.8 2019/03/09 16:18:22 christos Exp $");
+__RCSID("$NetBSD: cvslatest.c,v 1.9 2020/11/03 22:21:43 christos Exp $");
 
 /*
  * Find the latest timestamp in a set of CVS trees, by examining the
@@ -115,10 +115,18 @@
                        goto mal;
                if ((dt = strtok(NULL, "/")) == NULL)
                        goto mal;
+               if (strcmp(dt, "dummy timestamp") == 0) {
+                       warnx("Can't get timestamp from uncommitted file `%s'",
+                           ename);
+                       if (!ignore)
+                               exit(EXIT_FAILURE);
+                       continue;
+               }
                if ((p = strptime(dt, fmt, &tm)) == NULL || *p) {
                        warnx("Malformed time `%s' in `%s'", dt, ename);
                        if (!ignore)
                                exit(EXIT_FAILURE);
+                       continue;
                }
                tm.tm_isdst = 0;        // We are in GMT anyway
                if ((t = mktime(&tm)) == (time_t)-1)
@@ -132,6 +140,8 @@
                                printlat(lat);
                }
        }
+       if (ferror(fp))
+               err(EXIT_FAILURE, "Can't read `%s'", ename);
 
        fclose(fp);
        return;



Home | Main Index | Thread Index | Old Index