Hi!
> +static void setup(void)
> +{
> +     char tmp[PATH_MAX];
> +
> +     tst_require_root(NULL);
> +
> +     /* runtime check if syscall is supported */
> +     syscall(__NR_setns, -1, 0);
> +

What happens when the syscall is not supported? The call should return
-1 and errno should be set to ENOSYS but the return value is not
checked, I'm puzzled.

> +     /* check if kernel has CONFIG_*_NS set and exports /proc entries */
> +     ns_ipc_fd = get_ns_fd(getpid(), "ns/ipc");
> +     ns_uts_fd = get_ns_fd(getpid(), "ns/uts");
> +     if (ns_ipc_fd == -1 && ns_uts_fd == -1)
> +             tst_brkm(TCONF, NULL, "your kernel has CONFIG_IPC_NS, "
> +                     "CONFIG_UTS_NS or CONFIG_PROC disabled");
> +
> +     if (getcwd(tmp, PATH_MAX) == NULL)
> +             tst_brkm(TBROK|TERRNO, NULL, "getcwd");
> +     ipc_key = ftok(tmp, 65);
> +     shmid = shmget(ipc_key, getpagesize(), IPC_CREAT | 0666);
> +     if (shmid == -1)
> +             tst_brkm(TBROK|TERRNO, NULL, "shmget");
> +
> +     TEST_PAUSE;
> +}

-- 
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to