From: Matthew Fernandez Date: Sat, 29 May 2021 17:45:32 +0000 (-0700) Subject: handle unexpected getopt errors in nop X-Git-Tag: 2.47.3~16^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e4b10b87ed18a4435722a29d6a235da15cf462f1;p=graphviz handle unexpected getopt errors in nop This case is never expected to be reachable. However, having a default case helps catch when new options are introduced in the getopt call but not handled in the switch. In a sense, this is a defensive coding measure. This also squashes a -Wswitch-default compiler warning. --- diff --git a/cmd/tools/nop.c b/cmd/tools/nop.c index 324c7df4e..a36fd7a97 100644 --- a/cmd/tools/nop.c +++ b/cmd/tools/nop.c @@ -53,6 +53,9 @@ static void init(int argc, char *argv[]) usage(1); } break; + default: + fprintf(stderr, "nop: unexpected error\n"); + exit(EXIT_FAILURE); } } argv += optind;