cutils: work around platform differences in strto{l,ul,ll,ull}
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 10 Sep 2015 08:02:00 +0000 (10:02 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 10 Sep 2015 08:02:00 +0000 (10:02 +0200)
commit47d4be12c3997343e436c6cca89aefbbbeb70863
treea4edcff0049477f2a63a375f29263f4d222d8696
parent9fd1a94888cd6a559f95c3596ec1ac28b74838c1
cutils: work around platform differences in strto{l,ul,ll,ull}

Linux returns 0 if no conversion was made, while OS X and presumably
the BSDs return EINVAL.  The OS X convention rejects more invalid
inputs, so convert to it and adjust the test case.

Windows returns 1 from strtoul and strtoull (instead of -1) for
negative out-of-range input; fix it up.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tests/test-cutils.c
util/cutils.c