[LTP] [PATCH v1 3/4] syscalls/capset03: add new EPERM error test without CAP_SETPCAP

Cyril Hrubis
2020-01-07T13:39:13Z

Hi!
> +static void setup(void)
> +{
> + pid_t pid;
> +
> + pid = getpid();
> + header.pid = pid;
> + if (geteuid() == 0) {
> + TEST(tst_syscall(__NR_capset, &header, data));
> + if (TST_RET == -1)
> + tst_brk(TBROK | TTERRNO, "capset data failed");
> + }

Please don't do that. If tests needs root (even for a subset of the
test) just set the .needs_root flag.

> +}
> +
> +static struct tst_test test = {
> + .setup = setup,
> + .test_all = verify_capset,
> + .caps = (struct tst_cap []) {
> + TST_CAP(TST_CAP_DROP, CAP_SETPCAP),
> + {}
> + },
> +};
> --
> 2.18.0
>
>
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp

--
Cyril Hrubis
chrubis@suse.cz