This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Fix nss/tst-nss-test1.c format warning
- From: Joseph Myers <joseph at codesourcery dot com>
- To: <libc-alpha at sourceware dot org>
- Date: Wed, 26 Nov 2014 22:47:33 +0000
- Subject: Fix nss/tst-nss-test1.c format warning
- Authentication-results: sourceware.org; auth=none
Testing for 32-bit x86 shows up a warning "tst-nss-test1.c:25:3:
warning: format '%ju' expects argument of type 'uintmax_t', but
argument 2 has type 'int' [-Wformat=]". The argument is a difference
of two pointers, a signed quantity of type ptrdiff_t for which the
right format is %td; this patch makes this test use that format.
Tested for 32-bit x86.
2014-11-26 Joseph Myers <joseph@codesourcery.com>
* nss/tst-nss-test1.c (do_test): Use %td printf format for pointer
difference, not %ju.
diff --git a/nss/tst-nss-test1.c b/nss/tst-nss-test1.c
index 4e443d4..c5750e0 100644
--- a/nss/tst-nss-test1.c
+++ b/nss/tst-nss-test1.c
@@ -21,7 +21,7 @@ do_test (void)
if (p->pw_uid != *np || strncmp (p->pw_name, "name", 4) != 0
|| atol (p->pw_name + 4) != *np)
{
- printf ("passwd entry %ju wrong (%s, %u)\n",
+ printf ("passwd entry %td wrong (%s, %u)\n",
np - pwdids, p->pw_name, p->pw_uid);
retval = 1;
break;
--
Joseph S. Myers
joseph@codesourcery.com