From: deraadt Date: Fri, 24 Dec 2021 22:08:37 +0000 (+0000) Subject: when getopts prints "unknown option" or "requires argument", it should X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=12854997a4908b4da3fb40631684f79a89e38b6e;p=openbsd when getopts prints "unknown option" or "requires argument", it should not print the shell script line number where this occured. Doing so is pointless, or an information leak. This change does not affect any other error reporting. ok millert --- diff --git a/bin/ksh/misc.c b/bin/ksh/misc.c index 3d1e0cd4afb..809fae38d94 100644 --- a/bin/ksh/misc.c +++ b/bin/ksh/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.77 2021/12/15 04:01:52 deraadt Exp $ */ +/* $OpenBSD: misc.c,v 1.78 2021/12/24 22:08:37 deraadt Exp $ */ /* * Miscellaneous functions @@ -905,7 +905,7 @@ ksh_getopt(char **argv, Getopt *go, const char *options) go->buf[0] = c; go->optarg = go->buf; } else { - warningf(true, "%s%s-%c: unknown option", + warningf(false, "%s%s-%c: unknown option", (go->flags & GF_NONAME) ? "" : argv[0], (go->flags & GF_NONAME) ? "" : ": ", c); if (go->flags & GF_ERROR) @@ -931,7 +931,7 @@ ksh_getopt(char **argv, Getopt *go, const char *options) go->optarg = go->buf; return ':'; } - warningf(true, "%s%s-`%c' requires argument", + warningf(false, "%s%s-`%c' requires argument", (go->flags & GF_NONAME) ? "" : argv[0], (go->flags & GF_NONAME) ? "" : ": ", c); if (go->flags & GF_ERROR)