From a6f0cbaf4443d2820c46a0865fc928e259f770c1 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Tue, 1 Sep 2020 14:09:49 +0100 Subject: trivial: Check the return code of g_option_context_parse() --- tools/gusb-main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/gusb-main.c b/tools/gusb-main.c index 8f402c1..ef8c2e1 100644 --- a/tools/gusb-main.c +++ b/tools/gusb-main.c @@ -437,7 +437,12 @@ main (int argc, char *argv[]) priv->context = g_option_context_new ("GUSB Console Program"); g_option_context_add_main_entries (priv->context, options, NULL); - g_option_context_parse (priv->context, &argc, &argv, NULL); + if (!g_option_context_parse (priv->context, &argc, &argv, &error)) { + g_printerr ("Failed to parse arguments: %s\n", error->message); + g_error_free (error); + retval = 2; + goto out; + } /* verbose? */ if (verbose) { -- cgit v1.2.1