[CRIU] [PATCH] zdtm: don't hide errors in cgroup02.hook

Andrey Vagin avagin at openvz.org
Tue Aug 26 04:26:12 PDT 2014


rmdir is executed for non-existent directories, so we don't check
an exit code of this operation.

This patch executs rmdir only for existent directories and check
an exit code of rmdir.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 test/zdtm/live/static/cgroup02.hook | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/test/zdtm/live/static/cgroup02.hook b/test/zdtm/live/static/cgroup02.hook
index 5f4d042..75bfb42 100755
--- a/test/zdtm/live/static/cgroup02.hook
+++ b/test/zdtm/live/static/cgroup02.hook
@@ -7,11 +7,9 @@ rmroots() {
 
 	mount -t cgroup none $tname -o "$1"
 
-	set +e
-	rmdir "$tname/oldroot"
-	rmdir "$tname/newroot"
-	rmdir "$tname/zdtmtstroot"
-	set -e
+	for d in "$tname/oldroot" "$tname/newroot" "$tname/zdtmtstroot"; do
+		test -d "$d" && rmdir "$d"
+	done
 
 	echo "Left there is:"
 	ls "$tname"
-- 
1.9.3



More information about the CRIU mailing list