[LTP] [PATCH v4] Remove ltp_clone_quick usage from pidns suite

Cyril Hrubis chrubis@suse.cz
Tue Aug 1 10:44:21 CEST 2023


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


More information about the ltp mailing list