[LTP] [PATCH 1/1] syscalls: Add missing WEXITSTATUS() check

Petr Vorel pvorel@suse.cz
Tue Nov 12 12:00:52 CET 2024


Hi Cyril,

> > +++ b/testcases/kernel/syscalls/madvise/madvise08.c
> > @@ -173,7 +173,7 @@ static pid_t run_child(int advice)
> >  	SAFE_WAITPID(pid, &status, 0);
> >  	if (WIFSIGNALED(status) && WCOREDUMP(status))
> >  		return pid;
> > -	if (WIFEXITED(status))
> > +	if (WIFEXITED(status) && !WEXITSTATUS(status))
> >  		return 0;

> >  	tst_res(TCONF, "No coredump produced after signal (%d)",

> This one is not complete. We do exit(1) if madvise fails that would be
> previously caught here so we have to add:

> diff --git a/testcases/kernel/syscalls/madvise/madvise08.c b/testcases/kernel/syscalls/madvise/madvise08.c
> index 96bcaf159..f8f74ef4f 100644
> --- a/testcases/kernel/syscalls/madvise/madvise08.c
> +++ b/testcases/kernel/syscalls/madvise/madvise08.c
> @@ -165,7 +165,7 @@ static pid_t run_child(int advice)
>                                 fmem,
>                                 FMEMSIZE,
>                                 advstr);
> -                       exit(1);
> +                       exit(0);
>                 }
>                 abort();
>         }

Good catch, thanks!

Maybe it'd be more logical to keep exit(1) (it's error) and check against
WEXITSTATUS(status) == 1, but it's a minor detail, let's keep exit(0).

Can I merge with your RBT?

Kind regards,
Petr



More information about the ltp mailing list