Skip to contentSkip to conversation

contrib/vhost-user-blk: add missing GOptionEntry NULL terminator

PATCH Applied Stefan Hajnoczi 2 participants 3 messages Apr 11, 2022 – Apr 12, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 contrib/vhost-user-blk: add missing GOptionEntry NULL terminator

The GLib documentation says "a NULL-terminated array of GOptionEntrys" so we'd better make sure there is a terminator that lets g_option_context_add_main_entries() know when the end of the array has been reached.

---
 contrib/vhost-user-blk/vhost-user-blk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
contrib/vhost-user-blk/vhost-user-blk.c +2 -1
index d14b2896bf..cd4a5d7335 100644
@@ -593,7 +593,8 @@ static GOptionEntry entries[] = {
     {"blk-file", 'b', 0, G_OPTION_ARG_FILENAME, &opt_blk_file,
      "block device or file path", "PATH"},
     { "read-only", 'r', 0, G_OPTION_ARG_NONE, &opt_read_only,
-      "Enable read-only", NULL }
+      "Enable read-only", NULL },
+    { NULL, },
 };
 
 int main(int argc, char **argv)
Signature · 1 line
2.35.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Stefan Hajnoczi

The GLib documentation says "a NULL-terminated array of GOptionEntrys" so we'd better make sure there is a terminator that lets g_option_context_add_main_entries() know when the end of the array has been reached.

feel free to merge

Quoted 20 lines
---
 contrib/vhost-user-blk/vhost-user-blk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
contrib/vhost-user-blk/vhost-user-blk.c +2 -1
index d14b2896bf..cd4a5d7335 100644
@@ -593,7 +593,8 @@ static GOptionEntry entries[] = {
     {"blk-file", 'b', 0, G_OPTION_ARG_FILENAME, &opt_blk_file,
      "block device or file path", "PATH"},
     { "read-only", 'r', 0, G_OPTION_ARG_NONE, &opt_read_only,
-      "Enable read-only", NULL }
+      "Enable read-only", NULL },
+    { NULL, },
 };
 
 int main(int argc, char **argv)
Signature · 1 line
2.35.1
author Applied
#2 lore raw
In reply to Stefan Hajnoczi
Quoted 9 lines · Stefan Hajnoczi

The GLib documentation says "a NULL-terminated array of GOptionEntrys" so we'd better make sure there is a terminator that lets g_option_context_add_main_entries() know when the end of the array has been reached.

---
 contrib/vhost-user-blk/vhost-user-blk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Thanks, applied to my block-next tree:
https://gitlab.com/stefanha/qemu/commits/block-next

Stefan