From 1631f217456127bc1c7f14d4aa2eb3ad448c0049 Mon Sep 17 00:00:00 2001 From: Rebecca Cran Date: Thu, 20 Feb 2020 21:29:59 +0000 Subject: [PATCH] dtc: remove unknown option printf, since getopt will print it Since we don't set opterr to 0, getopt prints a message when it encounters an unknown/invalid option. We therefore don't need to print our own message in the default handler. Reviewed by: kevans, theraven Differential Revision: https://reviews.freebsd.org/D23662 --- usr.bin/dtc/dtc.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/usr.bin/dtc/dtc.cc b/usr.bin/dtc/dtc.cc index 0cda698011ef..14d3685ba9d4 100644 --- a/usr.bin/dtc/dtc.cc +++ b/usr.bin/dtc/dtc.cc @@ -304,7 +304,10 @@ main(int argc, char **argv) } break; default: - fprintf(stderr, "Unknown option %c\n", ch); + /* + * Since opterr is non-zero, getopt will have + * already printed an error message. + */ return EXIT_FAILURE; } }