[PATCH] Fix: helper function virCompareLimitUlong should return -1 when the latter parameter is 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Bing Bu Cao <mars@xxxxxxxxxxxxxxxxxx>

The helper function virCompareLimitUlong compare limit values,
where value of 0 is equal to unlimited, if the latter parameter is 0,
it should return -1 instead of 1, hence the user can only set hard_limit when
swap_hard_limit currently is unlimited.

Signed-off-by: Bing Bu Cao <mars@xxxxxxxxxxxxxxxxxx>
---
 src/util/virutil.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/util/virutil.c b/src/util/virutil.c
index d9e0bc4..3dcf1fe 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -2067,6 +2067,9 @@ virCompareLimitUlong(unsigned long long a, unsigned long b)
     if (a == b)
         return 0;
 
+    if (0 == b)
+        return -1;
+
     if (a == 0 || a > b)
         return 1;
 
-- 
1.7.7.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]