[Libguestfs] [PATCH nbdkit 2/5] FIX: Use nbdkit_parse_size to parse the size. (So that size=256M etc works)

Richard W.M. Jones rjones at redhat.com
Wed Jun 16 16:15:41 UTC 2021


---
 plugins/floppy/floppy.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/plugins/floppy/floppy.c b/plugins/floppy/floppy.c
index 24850300..80f350af 100644
--- a/plugins/floppy/floppy.c
+++ b/plugins/floppy/floppy.c
@@ -72,6 +72,8 @@ floppy_unload (void)
 static int
 floppy_config (const char *key, const char *value)
 {
+  int64_t r;
+
   if (strcmp (key, "dir") == 0) {
     if (dir != NULL) {
       /* TODO: Support merging of multiple directories, like iso plugin. */
@@ -86,8 +88,10 @@ floppy_config (const char *key, const char *value)
     label = value;
   }
   else if (strcmp (key, "size") == 0) {
-    if (nbdkit_parse_uint64_t ("size", value, &size) == -1)
+    r = nbdkit_parse_size (value);
+    if (r == -1)
       return -1;
+    size = r;
   }
   else {
     nbdkit_error ("unknown parameter '%s'", key);
-- 
2.32.0




More information about the Libguestfs mailing list