[Freeipa-devel] [PATCH] extop: For printf formatting warning

Sumit Bose sbose at redhat.com
Wed Mar 18 10:39:15 UTC 2015


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 <jhrozek at 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' ?

bye,
Sumit

>  
>      ret = 0;
>  
> -- 
> 2.1.0
> 

> -- 
> 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




More information about the Freeipa-devel mailing list