From 0f31d231db7502a6470fea4db9c3bf9aa48c1fd5 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 12 Feb 2013 20:36:22 +0000 Subject: [PATCH] Return error for --foo when using compat/getopt.c. --- compat/getopt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compat/getopt.c b/compat/getopt.c index 3a532372..38c317cc 100644 --- a/compat/getopt.c +++ b/compat/getopt.c @@ -67,6 +67,8 @@ BSDgetopt(int nargc, char *const *nargv, const char *ostr) return (-1); } if (place[1] && *++place == '-') { /* found "--" */ + if (place[1]) + return (BADCH); ++BSDoptind; place = EMSG; return (-1);