[LTP] [PATCH v5 3/3] controllers/cpuacct: fix rmdir failures on early test abort

Petr Vorel pvorel@suse.cz
Thu Sep 2 10:18:36 CEST 2021


Hi Krzysztof,

...
> -	if [ -d "$testpath/subgroup_1" ]; then
> -		rmdir $testpath/subgroup_*
> +	if [ "$testpath" ]; then
> +		if [ -d "$testpath/subgroup_1" ]; then
> +			rmdir $testpath/subgroup_*
> +		fi
> +		rmdir $testpath
>  	fi

> -	rmdir $testpath
> -

LGTM, but how about use `rm -rf' instead?

e.g.

if [ "$testpath" ]; then
	rm -rf $testpath
fi

That could simplify checks. Or is it needed to use `rmdir' to make sure there is
no content in the directory? I suppose check like this is needed in cleanup,
thus no problem to use `rm -rf'.

Kind regards,
Petr


More information about the ltp mailing list