[LTP] [PATCH] syscalls/mmap06: use macro TST_EXP_FAIL_PTR_VOID()

Petr Vorel pvorel@suse.cz
Tue May 7 18:53:47 CEST 2024


Hi Avinesh,

...
> -	TESTPTR(mmap(NULL, tc->length, tc->prot, tc->flags, fd, 0));
> -
> -	if (TST_RET_PTR != MAP_FAILED) {
> -		tst_res(TFAIL, "mmap() was successful unexpectedly");
> -		SAFE_MUNMAP(TST_RET_PTR, MMAPSIZE);
> -	} else if (TST_ERR == tc->exp_errno) {
> -		tst_res(TPASS | TERRNO, "mmap() failed with");
> -	} else {
> -		tst_res(TFAIL | TERRNO, "mmap() failed unexpectedly");
> -	}
> +	TST_EXP_FAIL_PTR_VOID(mmap(NULL, tc->length, tc->prot, tc->flags, fd, 0), tc->exp_errno);

Also here should IMHO be:

	if (TST_RET_PTR != MAP_FAILED) {
		SAFE_MUNMAP(TST_RET_PTR, page_sz);

Kind regards,
Petr

>  }

>  static void cleanup(void)


More information about the ltp mailing list