diff options
author | Eric Blake <eblake@redhat.com> | 2012-03-02 16:58:05 -0700 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2012-03-07 18:24:43 -0700 |
commit | 239fb8c46bbbbc76189dd7874c737dce6399ab87 (patch) | |
tree | 7bb7632baa01e7a84f750f968abee0c9d6820156 /daemon | |
parent | docs: use correct terminology for 1024 bytes (diff) | |
download | libvirt-239fb8c46bbbbc76189dd7874c737dce6399ab87.tar.gz libvirt-239fb8c46bbbbc76189dd7874c737dce6399ab87.tar.bz2 libvirt-239fb8c46bbbbc76189dd7874c737dce6399ab87.zip |
api: add overflow error
Overflow can be user-induced, so it deserves more than being called
an internal error. Note that in general, 32-bit platforms have
far more places to trigger this error (anywhere the public API
used 'unsigned long' but the other side of the connection is a
64-bit server); but some are possible on 64-bit platforms (where
the public API computes the product of two numbers).
* include/libvirt/virterror.h (VIR_ERR_OVERFLOW): New error.
* src/util/virterror.c (virErrorMsg): Translate it.
* src/libvirt.c (virDomainSetVcpusFlags, virDomainGetVcpuPinInfo)
(virDomainGetVcpus, virDomainGetCPUStats): Use it.
* daemon/remote.c (HYPER_TO_TYPE): Likewise.
* src/qemu/qemu_driver.c (qemuDomainBlockResize): Likewise.
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/remote.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/daemon/remote.c b/daemon/remote.c index 39302cc3b..0dd4f2e35 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -57,14 +57,15 @@ __FUNCTION__, __LINE__, __VA_ARGS__) #if SIZEOF_LONG < 8 -# define HYPER_TO_TYPE(_type, _to, _from) \ - do { \ - if ((_from) != (_type)(_from)) { \ - virNetError(VIR_ERR_INTERNAL_ERROR, \ - _("conversion from hyper to %s overflowed"), #_type); \ - goto cleanup; \ - } \ - (_to) = (_from); \ +# define HYPER_TO_TYPE(_type, _to, _from) \ + do { \ + if ((_from) != (_type)(_from)) { \ + virNetError(VIR_ERR_OVERFLOW, \ + _("conversion from hyper to %s overflowed"), \ + #_type); \ + goto cleanup; \ + } \ + (_to) = (_from); \ } while (0) # define HYPER_TO_LONG(_to, _from) HYPER_TO_TYPE(long, _to, _from) |