From 81d0d262d83345d3f50b21b0926b740027a1020a Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@fb.com>
Date: Sat, 9 Mar 2019 21:38:03 -0800
Subject: [PATCH] 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.
---
 ChangeLog             | 9 +++++++++
 tests/test-userspec.c | 6 ++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4efd9bccc..27c50744c 100644
--- 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.
diff --git a/tests/test-userspec.c b/tests/test-userspec.c
index 8211aa234..800169bb2 100644
--- a/tests/test-userspec.c
+++ b/tests/test-userspec.c
@@ -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;
     }
-- 
2.21.0.135.g6e0cc67761

