From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH] conf: Fix getopt_long() optstring for current semantics of -D, -S, -p Date: Fri, 02 Sep 2022 16:55:50 +0200 Message-ID: <20220902145550.2492516-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1499739573220275675==" --===============1499739573220275675== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Declaring them as required_argument in the longopts array specifies validation, but doesn't affect how optind is increased after parsing their values. Currently, passing one of these options as last option causes pasta to handle their own values as path to a binary to execute. Fixes: aae2a9bbf7d1 ("conf: Use "-D none" and "-S none" instead of missing em= pty option arguments") Fixes: bf95322fc1ef ("conf: Make the argument to --pcap option mandatory") Signed-off-by: Stefano Brivio --- conf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf.c b/conf.c index e6d1c62..2edb4ae 100644 --- a/conf.c +++ b/conf.c @@ -1094,9 +1094,9 @@ void conf(struct ctx *c, int argc, char **argv) const char *optstring; =20 if (c->mode =3D=3D MODE_PASST) - optstring =3D "dqfehs:p::P:m:a:n:M:g:i:D::S::46t:u:"; + optstring =3D "dqfehs:p:P:m:a:n:M:g:i:D:S:46t:u:"; else - optstring =3D "dqfehI:p::P:m:a:n:M:g:i:D::S::46t:u:T:U:"; + optstring =3D "dqfehI:p:P:m:a:n:M:g:i:D:S:46t:u:T:U:"; =20 name =3D getopt_long(argc, argv, optstring, options, NULL); =20 --=20 2.35.1 --===============1499739573220275675==--