Fix: Tests: `gen-ust-events` doesn't error out on invalid option
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Wed, 4 Mar 2020 21:18:37 +0000 (16:18 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 17 Mar 2020 17:43:36 +0000 (13:43 -0400)
Issue
=====
When running `gen-ust-events` with an invalid option:
  ./gen-ust-events -h

The `getopt_long()` function prints the following error:
  ./gen-ust-events: invalid option -- 'h'

which is very kind of it.

The problem is that the process keep running and go on to generate
events. It should exit right away.

Solution
========
Remove the `break` statement and so that we execute the `goto end`
right away.

Apply the same changes to `gen-ust-nevents`.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ib1c96f4c9ed8f98395bf842215f858a69db2bbf0
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/utils/testapp/gen-ust-events/gen-ust-events.c
tests/utils/testapp/gen-ust-nevents/gen-ust-nevents.c

index 51e53a6203781c5004aba5242c53746a02ec3638..7ce86bcaeb874de64a7a282d65a928d68b171e69 100644 (file)
@@ -90,7 +90,6 @@ int main(int argc, char **argv)
                        break;
                case '?':
                        /* getopt_long already printed an error message. */
-                       break;
                default:
                        ret = -1;
                        goto end;
index 3293687314aea3e213f470361d5a137bd0b5eace..abbc72e1285037f5edc8d1b8e78b83d04bd775e8 100644 (file)
@@ -51,7 +51,6 @@ int main(int argc, char **argv)
                        break;
                case '?':
                        /* getopt_long already printed an error message. */
-                       break;
                default:
                        ret = -1;
                        goto end;
This page took 0.034445 seconds and 4 git commands to generate.