Hi,

On 22/06/18 22:45, Selva Nair wrote:
[cut]
>> --- a/src/openvpn/route.c
>> +++ b/src/openvpn/route.c
>> @@ -1616,7 +1616,7 @@ add_route(struct route_ipv4 *r, const struct tuntap
> *tt, unsigned int flags,
>>          if (is_on_link(is_local_route, flags, rgi))
>>          {
>>              ai = rgi->adapter_index;
>> -            argv_printf_cat(&argv, "IF %lu", ai);
>> +            argv_printf_cat(&argv, "IF %u", ai);
>>          }
>>
>>          argv_msg(D_ROUTE, &argv);
> 
> Thanks for cleaning up my mistake (commit
> 06ad53e067d9a8be571a27f44005fa7e8038f69e introduced this). One
> purpose of that commit was to get rid of -Wformat warnings as those
> are not always benign. But this will re-introduce a warning as "ai" is
> unsigned long even though its the same size as unsigned.
> 
> Currently we do support building with -Werror=format (see
> https://patchwork.openvpn.net/patch/234/#463), so I suggest either
> cast to (unsigned)  which we know is safe here, or add "%lu" to
> argv_printf_arglist().
> 
> I would prefer the latter as its easy to overlook the fact that
> argv_printf_cat() can't handle %lu which is commonly used
> on Windows.

I was just about to test a v2 of this patch with the explicit cast to
"unsigned int". I was leaning towards the explicit cast because we
already print DWORD variables in several spots and we always cast them
to int or unsigned int.

However, if we believe supporting %lu can be more useful, I can do that.

Last opinion? :)

Cheers,



-- 
Antonio Quartulli

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to