From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson To: passt-dev@passt.top Subject: Re: [PATCH] conf: Fix getopt_long() optstring for current semantics of -D, -S, -p Date: Sat, 03 Sep 2022 19:32:13 +1000 Message-ID: In-Reply-To: <20220902145550.2492516-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7319655387151530062==" --===============7319655387151530062== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Fri, Sep 02, 2022 at 04:55:50PM +0200, Stefano Brivio wrote: > Declaring them as required_argument in the longopts array specifies > validation, but doesn't affect how optind is increased after parsing > their values. >=20 > Currently, passing one of these options as last option causes pasta > to handle their own values as path to a binary to execute. >=20 > Fixes: aae2a9bbf7d1 ("conf: Use "-D none" and "-S none" instead of missing = empty option arguments") > Fixes: bf95322fc1ef ("conf: Make the argument to --pcap option mandatory") > Signed-off-by: Stefano Brivio Oh, bother. I remember realizing that I needed to make that change while I was working on the patch... then forgetting to actually do so. Reviewed-by: David Gibson > --- > conf.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > 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 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --===============7319655387151530062== Content-Type: application/pgp-signature Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="signature.asc" MIME-Version: 1.0 LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KCmlRSXpCQUVCQ0FBZEZpRUVvVUx4V3U0L1dz MGRCK1h0Z3lwWTRnRXdZU0lGQW1NVEh4TUFDZ2tRZ3lwWTRnRXcKWVNJck5RLzlIamwrQlZmUVZH TTRYaFB1R1hoU3VsWU54enNHK2orQkxuVmN5bkp3R3ljVnpwUnAxajFiMWJPdwpzNlVZTFV3TUpI dzBFK1YxOVAwWkdKUVVubGhVS0hCREpBWU9KaVhqYkhCWUx3WHdESmFraVhuRUJuUURhdVJoCkJu VXZuWW5wTm50VktjbmZMTVc3QWc5bWhSQWd4d0kwQnNBaXc4ampMM0FPVUJNWStCOXI0dGNEeXlO akdGNkYKMFkxZmNXRnpZbHZuTHZ4Nk5WQldWbGI0RmNjMFBhbHJtQXRwUHZuRlB3SnpKRmJJNlJH Y2VPa1MrL21GWjgybQp4UExyUGFOTFNudHEvckovbjJSejlsSnZZWkYyb2hoTzFlRWJCM255bmhv SzZ0NUg3aWEvRXJtd0llcnExYS9NCjM2QnBvNXRRZWNrM0hjRVVkYWtYM3RoYml4SE1XdlVUQVZT TmJaSXNQdG5pclk3cG1sRnNqcGU2SUtOWU85aGwKRFJpYUR1bDlaOFVZK3l0d08xRmFYT0k1MjlQ aWZueFplQnYwUFNYZFZHelpFNGQ5NlFMa3dvYWcyYlF0N0dCUApGMG9QK2hrZ3FoSjVDNEVtaUhq cXpGNkRWRlFWazc0emZwWDl5S0hEN0t5VGVDUUFuOTYyR2U0RVYxZlhaL045ClpyTnVXVFpOS3ZB eW5XdUw2STdLaU5kMGVrWE1BbjJWV1N6MkhJZUw1UytEeU9ML0JieXVzc00vRTJtb0Q2YWsKaVpQ Z3A2dGZ6VW8zMkI0azBzUitObnBkaUxFcDVRUUozTDVHalEzdHBXNnBzN1RSOGVpYjRoc1Zzb1NC aUZCbAo5OS9MUkZLdDQ1NmMrMmpGYjFxcHZOTnM2Z0R5U2NnNVg2eXUwa3hKTFZQYjFUUDdvQjg9 Cj1yKzlNCi0tLS0tRU5EIFBHUCBTSUdOQVRVUkUtLS0tLQo= --===============7319655387151530062==--