pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/check-portability pkgtools/check-portability:...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/2f94d6d0bca3
branches:  trunk
changeset: 424682:2f94d6d0bca3
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Fri Mar 13 16:20:34 2020 +0000

description:
pkgtools/check-portability: update to 19.4.2

Changes since 19.4.1:

Fixed an assertion error when reading binary file, reported by tnn via
private mail.

diffstat:

 pkgtools/check-portability/Makefile                  |   4 ++--
 pkgtools/check-portability/files/check-portability.c |  13 +++++++++++--
 2 files changed, 13 insertions(+), 4 deletions(-)

diffs (55 lines):

diff -r 423b5199a936 -r 2f94d6d0bca3 pkgtools/check-portability/Makefile
--- a/pkgtools/check-portability/Makefile       Fri Mar 13 16:10:11 2020 +0000
+++ b/pkgtools/check-portability/Makefile       Fri Mar 13 16:20:34 2020 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.5 2020/03/13 08:17:18 rillig Exp $
+# $NetBSD: Makefile,v 1.6 2020/03/13 16:20:34 rillig Exp $
 
-PKGNAME=       check-portability-19.4.1
+PKGNAME=       check-portability-19.4.2
 CATEGORIES=    pkgtools
 DISTFILES=     # none
 
diff -r 423b5199a936 -r 2f94d6d0bca3 pkgtools/check-portability/files/check-portability.c
--- a/pkgtools/check-portability/files/check-portability.c      Fri Mar 13 16:10:11 2020 +0000
+++ b/pkgtools/check-portability/files/check-portability.c      Fri Mar 13 16:20:34 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: check-portability.c,v 1.7 2020/03/12 19:45:06 rillig Exp $ */
+/* $NetBSD: check-portability.c,v 1.8 2020/03/13 16:20:34 rillig Exp $ */
 
 /*
  Copyright (c) 2020 Roland Illig
@@ -107,6 +107,12 @@
 }
 
 static bool
+cstr_contains_char(cstr haystack, char needle)
+{
+       return memchr(haystack.data, needle, haystack.len);
+}
+
+static bool
 cstr_contains(cstr haystack, cstr needle)
 {
        return cstr_index(haystack, needle) != npos;
@@ -165,6 +171,7 @@
 static cstr
 str_c(str *s)
 {
+       assert(s->data != nullptr);
        return (cstr) { s->data, s->len };
 }
 
@@ -518,9 +525,11 @@
        }
 
        while (str_read_line(&line, f)) {
+               cstr cline = str_c(&line);
+               if (cstr_contains_char(str_c(&line), '\0'))
+                       break;
                lineno++;
                str_charptr(&line);
-               cstr cline = str_c(&line);
 
                checkline_sh_double_brackets(filename, lineno, cline);
                checkline_sh_dollar_random(filename, lineno, cline);



Home | Main Index | Thread Index | Old Index