mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-08 07:15:46 +00:00
build: avoid 32-bit failure on older gcc
On 32-bit platforms with old gcc (hello RHEL 5 gcc 4.1.2), the build fails with: virsh-domain.c: In function 'cmdBlockCopy': virsh-domain.c:2172: warning: comparison is always false due to limited range of data type Adjust the code to silence the warning. * tools/virsh-domain.c (cmdBlockCopy): Pacify RHEL 5 gcc. Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
512b8747d8
commit
0d5168392f
@ -2169,7 +2169,8 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (bandwidth) {
|
if (bandwidth) {
|
||||||
/* bandwidth is ulong MiB/s, but the typed parameter is
|
/* bandwidth is ulong MiB/s, but the typed parameter is
|
||||||
* ullong bytes/s; make sure we don't overflow */
|
* ullong bytes/s; make sure we don't overflow */
|
||||||
if (bandwidth + 0ULL > ULLONG_MAX >> 20) {
|
unsigned long long limit = MIN(ULONG_MAX, ULLONG_MAX >> 20);
|
||||||
|
if (bandwidth > limit) {
|
||||||
virReportError(VIR_ERR_OVERFLOW,
|
virReportError(VIR_ERR_OVERFLOW,
|
||||||
_("bandwidth must be less than %llu"),
|
_("bandwidth must be less than %llu"),
|
||||||
ULLONG_MAX >> 20);
|
ULLONG_MAX >> 20);
|
||||||
|
Loading…
Reference in New Issue
Block a user