[LTP] [PATCH STAGING v4 07/16] fchroot04: test fchroot() into failfs as root
Cyril Hrubis
chrubis@suse.cz
Mon Oct 12 13:03:51 CEST 2026
Hi!
> +static void run(void)
> +{
> + if (SAFE_FORK())
> + return;
> +
> + char buf[PATH_MAX];
> +
> + TST_EXP_PASS(tst_syscall(__NR_fchroot, FD_FAILFS_ROOT, 0),
> + "fchroot() with the FD_FAILFS_ROOT sentinel");
> +
> + TST_EXP_FAIL2(open("/etc/passwd", O_RDONLY), EOPNOTSUPP,
> + "absolute file open");
> +
> + TST_EXP_FAIL(mkdir("/foo", 0700), EOPNOTSUPP,
> + "absolute directory creation");
> +
> + /*
> + * The libc getcwd() wrapper rejects the "(unreachable)"
> + * prefix produced by the kernel, so call the raw syscall.
> + */
> + TEST(tst_syscall(__NR_getcwd, buf, sizeof(buf)));
> + if (TST_RET > 0)
> + TST_EXP_EQ_STRN(buf, UNR_TAG, sizeof(UNR_TAG) - 1);
> + else
> + tst_res(TFAIL | TTERRNO, "getcwd() failed");
> +
> + exit(0);
Here as well, no need to add the exit(0)
Otherwise:
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list