[LTP] [PATCH] setfsuid02: Rewrite using new LTP API

Richard Palethorpe rpalethorpe@suse.de
Tue Oct 25 09:59:36 CEST 2022


hello,

Avinesh Kumar <akumar@suse.de> writes:

> Rewrite using new API and add setfsuid(-1) call to verify that preceding
> setfsuid() call with an invalid fsuid had failed.

Merged with a couple of changes.

> +	TST_EXP_VAL_SILENT(setfsuid(invalid_uid), current_uid);

Need to use the SETFSUID macro for 16-bit (as pvorel said).

> +	TST_EXP_VAL(setfsuid(-1), current_uid,
> +				"setfsuid(invalid_fsuid) test for
> expected failure:");

Substituted invalid_uid for -1 because -1 (UINT_MAX or USHORT_MAX) could
be a valid UID AFAICT.

>  }
>  
> -static void setup(void)
> -{
> -	tst_sig(NOFORK, DEF_HANDLER, cleanup);
> -
> -	TEST_PAUSE;
> -}
> -
> -static void cleanup(void)
> -{
> -}
> +static struct tst_test test = {
> +	.test_all = run
> +};
> -- 
> 2.37.3


-- 
Thank you,
Richard.


More information about the ltp mailing list