public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v4] Remove ltp_clone_quick usage from pidns suite
Date: Tue, 1 Aug 2023 10:44:21 +0200	[thread overview]
Message-ID: <ZMjF5WK60ziGD6yt@yuki> (raw)
In-Reply-To: <20230731114931.13656-1-andrea.cervesato@suse.de>

Hi!
> -int find_cinit_pids(pid_t * pids)
> +static int find_cinit_pids(pid_t *pids)
>  {
> -	int next = 0, pid_max, i;
> +	int i;
> +	int next = 0;
>  	pid_t parentpid, pgid, pgid2;
>  
> -	pid_max = max_pid();
>  	parentpid = getpid();
> -	pgid = getpgid(parentpid);
> +	pgid = SAFE_GETPGID(parentpid);
>  
> -	/* The loop breaks, when the loop counter reaches the parentpid value */
>  	for (i = parentpid + 1; i != parentpid; i++) {
>  		if (i > pid_max)
>  			i = 2;

Can we please, as I asked for in v1 review, just do loop from 2 to
pid_max here instead? It's effectively the same we do here but much
clearer code...

The rest looks good to me.

With the change to the loop above:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      parent reply	other threads:[~2023-08-01  8:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-31 11:49 [LTP] [PATCH v4] Remove ltp_clone_quick usage from pidns suite Andrea Cervesato
2023-07-31 11:51 ` Andrea Cervesato via ltp
2023-08-01  8:44 ` Cyril Hrubis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZMjF5WK60ziGD6yt@yuki \
    --to=chrubis@suse.cz \
    --cc=andrea.cervesato@suse.de \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox