[LTP] [PATCH 1/2] syscalls/quotatcl01.c: Rewrite && Convert to new API

Cyril Hrubis chrubis@suse.cz
Mon Oct 24 12:49:28 CEST 2016


Hi!
> -	tst_parse_opts(ac, av, (option_t *) opts, NULL);
> +	pid = SAFE_FORK();
> +	if (!pid)
> +		create_qf();
>  
> -	setup();
> +	SAFE_WAITPID(pid, NULL, 0);

Just use tst_run_cmd() instead of the fork(), execlp(), wait() combo and
remove the forks_child flag.

> -	for (lc = 0; TEST_LOOPING(lc); ++lc) {
> +	test_id = geteuid();
>  
> -		tst_count = 0;
> +	sprintf(usr_path, "%s/%s", mntpoint, usr_qf);
> +	sprintf(grp_path, "%s/%s", mntpoint, grp_qf);

Well these strings could be compile time constants. If you do:

#define MNTPOINT "mntpoint"

#ifdef HAVE_QUOTAV2
# define USR_PATH MNTPOINT "aquota.user"
...
#else
# define USR_PATH MNTPOINT "quota.user"
...
#endif

But that is a minor issue.

And yes, the inner block of #ifdef should ideally be indented with
single space per block as in the example snipped above, but that is even
more minor.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list