[PATCH 01/40] vl: fix -monitor none prefix matching

Marc-André Lureau posted 40 patches 2 months, 3 weeks ago
There is a newer version of this series
[PATCH 01/40] vl: fix -monitor none prefix matching
Posted by Marc-André Lureau 2 months, 3 weeks ago
Use g_strcmp0() for exact match instead of strncmp() which would
incorrectly treat any string starting with "none" as disabling
the monitor.

Fixes: 70e098af88f ("monitor: allow to disable the default monitor")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 system/vl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/system/vl.c b/system/vl.c
index e690aa3ed8c..f4d55f0addd 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -3216,7 +3216,7 @@ void qemu_init(int argc, char **argv)
                 }
             case QEMU_OPTION_monitor:
                 default_monitor = 0;
-                if (strncmp(optarg, "none", 4)) {
+                if (g_strcmp0(optarg, "none")) {
                     monitor_parse(optarg, "readline", false);
                 }
                 break;

-- 
2.54.0