]> git.proxmox.com Git - mirror_qemu.git/blobdiff - qemu-io-cmds.c
util/cutils: Return qemu_strtosz*() error and value separately
[mirror_qemu.git] / qemu-io-cmds.c
index e415b03cd0b0bf9074fc482b7e8fb5f01521cf2a..01a6dc6fbc6657ca296bbeea65be4d3432eee7a1 100644 (file)
@@ -137,15 +137,14 @@ static char **breakline(char *input, int *count)
 
 static int64_t cvtnum(const char *s)
 {
-    char *end;
-    int64_t ret;
+    int err;
+    int64_t value;
 
-    ret = qemu_strtosz_suffix(s, &end, QEMU_STRTOSZ_DEFSUFFIX_B);
-    if (*end != '\0') {
-        /* Detritus at the end of the string */
-        return -EINVAL;
+    err = qemu_strtosz(s, NULL, &value);
+    if (err < 0) {
+        return err;
     }
-    return ret;
+    return value;
 }
 
 static void print_cvtnum_err(int64_t rc, const char *arg)