[LTP] [PATCH v5 1/1] syscalls/mq_unlink: convert to use new test library API

Cyril Hrubis chrubis@suse.cz
Mon Dec 5 15:49:44 CET 2016


Hi!
> +	pw = SAFE_GETPWNAM("nobody");
> I don't like hardwired constants, but nobody user name is used across whole
> codebase. I'd be happier to have some constant in lib (although it's unlikely
> one day we might want to allow user to choose their "nobody" user).

Yep, I've been thinking of adding uid_t tst_get_nobody_uid(void) or
uid_t tst_get_unprivileged_uid(void) and the same for gid_t or something
similar into the test library for some time. Haven't had time to do so
yet.

> > We may also run the test for nobody in a child process so
> > that we don't have to take care restoring the euid at the end of the
> > function.
> It's require to restore euid for other tests (to be running as root again). Or
> have I overlooked something?

If you fork() then call setuid() in the child, do the test and exit then
parent will still run under the same uid it has been started. No need to
resetore anything.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list