diff mbox series

[v3,1/8] conntrack: reset optind in do_parse

Message ID 20210129212452.45352-2-mikhail.sennikovskii@cloud.ionos.com
State Changes Requested
Delegated to: Pablo Neira
Headers show
Series conntrack: save output format | expand

Commit Message

Mikhail Sennikovsky Jan. 29, 2021, 9:24 p.m. UTC
As a multicommand support preparation reset optind
for the case do_parse is called multiple times

Signed-off-by: Mikhail Sennikovsky <mikhail.sennikovskii@cloud.ionos.com>
---
 src/conntrack.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Pablo Neira Ayuso March 15, 2021, 5:18 p.m. UTC | #1
On Fri, Jan 29, 2021 at 10:24:45PM +0100, Mikhail Sennikovsky wrote:
> As a multicommand support preparation reset optind
> for the case do_parse is called multiple times

Patch looks good, I'd suggest to collapse it to 4/8 and 5/8 in the
next round.

Thanks.
Mikhail Sennikovsky March 17, 2021, 6:31 p.m. UTC | #2
Hi Pablo,

Sure, so taking into account your comments to 3/8 and 4/8 I collapse
1-5/8 in a single commit, correct?

Regards,
Mikhail

On Mon, 15 Mar 2021 at 18:18, Pablo Neira Ayuso <pablo@netfilter.org> wrote:
>
> On Fri, Jan 29, 2021 at 10:24:45PM +0100, Mikhail Sennikovsky wrote:
> > As a multicommand support preparation reset optind
> > for the case do_parse is called multiple times
>
> Patch looks good, I'd suggest to collapse it to 4/8 and 5/8 in the
> next round.
>
> Thanks.
Pablo Neira Ayuso March 24, 2021, 11:22 a.m. UTC | #3
On Wed, Mar 17, 2021 at 07:31:18PM +0100, Mikhail Sennikovsky wrote:
> Hi Pablo,
> 
> Sure, so taking into account your comments to 3/8 and 4/8 I collapse
> 1-5/8 in a single commit, correct?

Yes please. My understanding is that they belong to the same logical
changes, that is, add batch support.

So this new "batch support" for conntrack is all new code that can be
added at once IMO.

Thanks.
diff mbox series

Patch

diff --git a/src/conntrack.c b/src/conntrack.c
index 987d936..c582d86 100644
--- a/src/conntrack.c
+++ b/src/conntrack.c
@@ -2798,6 +2798,8 @@  static void do_parse(struct ct_cmd *ct_cmd, int argc, char *argv[])
 
 	/* disable explicit missing arguments error output from getopt_long */
 	opterr = 0;
+	/* reset optind, for the case do_parse is called multiple times */
+	optind = 0;
 
 	while ((c = getopt_long(argc, argv, getopt_str, opts, NULL)) != -1) {
 	switch(c) {