The db-3 subtest fails on 64-bit systems (and has been failing for a
long time, maybe forever?).  The problem is that (off_t)SIZE_MAX
becomes -1, so the

        if (sb.st_size > (off_t)SIZE_MAX)

condition is always true.  Since we pass (int)sb.st_size to read(2), I
think checking for INT_MAX is the easiest way to fix this test.  If we
ever put a >2G binary in /bin, we're in deep trouble anyway.

ok?


Index: regress/lib/libc/db/dbtest.c
===================================================================
RCS file: /cvs/src/regress/lib/libc/db/dbtest.c,v
retrieving revision 1.14
diff -u -p -r1.14 dbtest.c
--- regress/lib/libc/db/dbtest.c        23 Oct 2015 18:47:21 -0000      1.14
+++ regress/lib/libc/db/dbtest.c        16 Apr 2017 12:50:41 -0000
@@ -685,7 +685,7 @@ rfile(name, lenp)
        if ((fd = open(name, O_RDONLY, 0)) < 0 ||
            fstat(fd, &sb))
                dberr("%s: %s\n", name, strerror(errno));
-       if (sb.st_size > (off_t)SIZE_MAX)
+       if (sb.st_size > (off_t)INT_MAX)
                dberr("%s: %s\n", name, strerror(E2BIG));
        if ((p = (void *)malloc((u_int)sb.st_size)) == NULL)
                dberr("%s", strerror(errno));

Reply via email to