[PATCH kvm-unit-tests] parse_keyval: Allow hex vals

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

 



When parse_keyval was first written we didn't yet have strtol.
Now we do, let's give users more flexibility.

Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx>
---
 lib/util.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/util.c b/lib/util.c
index a90554138952..682ca2db09e6 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -4,6 +4,7 @@
  * This work is licensed under the terms of the GNU LGPL, version 2.
  */
 #include <libcflat.h>
+#include <stdlib.h>
 #include "util.h"
 
 int parse_keyval(char *s, long *val)
@@ -14,6 +15,6 @@ int parse_keyval(char *s, long *val)
 	if (!p)
 		return -1;
 
-	*val = atol(p+1);
+	*val = strtol(p+1, NULL, 0);
 	return p - s;
 }
-- 
2.31.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux