init: complain on unrecognized option with builtin getopt_long_only()
authorJens Axboe <axboe@kernel.dk>
Thu, 24 Jan 2013 01:11:48 +0000 (18:11 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 24 Jan 2013 01:11:48 +0000 (18:11 -0700)
It returns '?' for a bad option, whereas the glibc one does
not. Catch that so we behave identically.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
init.c

diff --git a/init.c b/init.c
index d22ed5fd57f9b432b157b9fcfb730f009515c5d1..fca74fe22bd1101f03813e19f937609ab7d1e07e 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1641,6 +1641,9 @@ int parse_cmd_line(int argc, char *argv[])
                        do_exit++;
                        exit_val = fio_monotonic_clocktest();
                        break;
+               case '?':
+                       log_err("%s: unrecognized option '%s'\n", argv[0],
+                                                       argv[optind - 1]);
                default:
                        do_exit++;
                        exit_val = 1;