Skip to content

Commit

Permalink
trivial: Check the return code of g_option_context_parse()
Browse files Browse the repository at this point in the history
  • Loading branch information
hughsie committed Sep 1, 2020
1 parent b2ca7eb commit a6f0cba
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/gusb-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a6f0cba

Please sign in to comment.