On (18/03/15 12:33), Jakub Hrozek wrote: >On Wed, Mar 18, 2015 at 11:39:15AM +0100, Sumit Bose wrote: >> On Wed, Mar 18, 2015 at 11:25:14AM +0100, Jakub Hrozek wrote: >> > I could swear I sent the patch last time when I was reviewing Sumit's >> > patches but apparently not. >> > >> > It's better to use %zu instead of %d for size_t formatting with recent >> > compilers. >> >> > >From a088e8c8a9bd29b4c22f1579f2c3705652bf2730 Mon Sep 17 00:00:00 2001 >> > From: Jakub Hrozek <jhro...@redhat.com> >> > Date: Wed, 18 Mar 2015 11:20:38 +0100 >> > Subject: [PATCH] extop: For printf formatting warning >> > >> > --- >> > daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_extop.c | 2 +- >> > 1 file changed, 1 insertion(+), 1 deletion(-) >> > >> > diff --git a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_extop.c >> > b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_extop.c >> > index >> > 708d0e4a2fc9da4f87a24a49c945587049f7280f..bc25e7643cdebe0eadc0cee4dcba3a392fdc33be >> > 100644 >> > --- a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_extop.c >> > +++ b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_extop.c >> > @@ -200,7 +200,7 @@ static int ipa_extdom_init_ctx(Slapi_PBlock *pb, >> > struct ipa_extdom_ctx **_ctx) >> > if (ctx->max_nss_buf_size == 0) { >> > ctx->max_nss_buf_size = DEFAULT_MAX_NSS_BUFFER; >> > } >> > - LOG("Maximal nss buffer size set to [%d]!\n", ctx->max_nss_buf_size); >> > + LOG("Maximal nss buffer size set to [%zu]!\n", ctx->max_nss_buf_size); >> >> I tried this some time ago and found the here not the glibc printf >> version is used but I guess some NSPR implementation which does not >> support the z specifier. So I would assum that this is not working as >> expected. Have you tried to trigger the error message or called LOG >> unconditionally with '%zu' ? > >No, I only tried compiling the code. I haven't expected non-standard >printf to be used. sorry. > >Then what about casting max_nss_buf_size to something large that the NSPR >implementation can handle (unsigned long?) > You can use th modifier "j" and cast to uintmax_t or intmax_t
man 3 printf says: j A following integer conversion corresponds to an intmax_t or uintmax_t argument, or a following n conversion corresponds to a pointer to an intmax_t argument. LS -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code