[libvirt] [PATCH] virConfGetValueSSizeT: Fix build on 32 bits

Eric Blake eblake at redhat.com
Thu Jul 14 22:52:11 UTC 2016


On 07/14/2016 03:45 PM, Michal Privoznik wrote:
> This function tries to get a ssize_t value from a config file.
> But before returning it, it checks whether the value would fit in
> ssize_t and if not an error is printed out among with the range
> for the ssize_t type. However, on some platforms SSIZE_MAX may
> actually be a signed long type:
> 
> util/virconf.c: In function 'virConfGetValueSSizeT':
> util/virconf.c:1268:9: error: format '%zd' expects argument of type 'signed size_t', but argument 9 has type 'long int' [-Werror=format=]
>          virReportError(VIR_ERR_INTERNAL_ERROR,
>          ^
> $ grep -r SSIZE_MAX /usr/include/
> /usr/include/bits/posix1_lim.h:#ifndef  SSIZE_MAX
> /usr/include/bits/posix1_lim.h:# define SSIZE_MAX       LONG_MAX
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/util/virconf.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

I plan on reverting this if I can figure out how to work around it in
gnulib; but the gnulib work turned out to be harder than I first
expected, because gnulib can't easily fix <limits.h>:
https://lists.gnu.org/archive/html/bug-gnulib/2016-07/msg00024.html

So in the meantime, ACK.


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160714/243dc8f1/attachment-0001.sig>


More information about the libvir-list mailing list