]> Savannah Git Hosting - gnulib.git/commitdiff
test-userspec.c: don't print NULL
authorJim Meyering <meyering@fb.com>
Sun, 10 Mar 2019 05:38:03 +0000 (21:38 -0800)
committerJim Meyering <meyering@fb.com>
Sun, 10 Mar 2019 05:38:03 +0000 (21:38 -0800)
* tests/test-userspec.c (main): A test release of gcc,
9.0.1 20190310, warned that this test would attempt to
print a NULL pointer via a %s printf format.  Fix that
and remove the unnecessary preceding "!diag" conjunct.
Also add a comment.

ChangeLog
tests/test-userspec.c

index 4efd9bccc44ed053a3cc77adb73cef1182bbb6a0..27c50744c369cd28af677059683b2e9fd740b851 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2019-03-09  Jim Meyering  <meyering@fb.com>
+
+       test-userspec.c: don't print NULL
+       * tests/test-userspec.c (main): A test release of gcc,
+       9.0.1 20190310, warned that this test would attempt to
+       print a NULL pointer via a %s printf format.  Fix that
+       and remove the unnecessary preceding "!diag" conjunct.
+       Also add a comment.
+
 2019-03-03  Bruno Haible  <bruno@clisp.org>
 
        getloadavg: Write NULL for the null pointer.
index 8211aa23498081df9991967e138471c766ef5574..800169bb295125656c2cb7da4e80cbc8e76566a0 100644 (file)
@@ -170,10 +170,12 @@ main (void)
           fail = 1;
         }
 
-      if (!diag && !T[i].result)
+      if (!T[i].result)
         continue;
 
-      printf ("%s diagnostic mismatch (-: expected uid,gid; +:actual)\n"
+      /* Expected a non-NULL result diagnostic, yet got NULL.  */
+      diag = "NULL";
+      printf ("%s diagnostic mismatch (-: expected diagnostic; +:actual)\n"
               "-%s\n+%s\n", T[i].in, T[i].result, diag);
       fail = 1;
     }