]> www.infradead.org Git - users/hch/blktests.git/commitdiff
cgroup: test if CGROUP2_DIR is set with -v instead of -n
authorOmar Sandoval <osandov@fb.com>
Thu, 17 Jan 2019 01:34:19 +0000 (17:34 -0800)
committerOmar Sandoval <osandov@fb.com>
Thu, 17 Jan 2019 01:34:19 +0000 (17:34 -0800)
common/multipath-over-rdma does set -u, so -n "$CGROUP2_DIR" fails with
an unbound variable error. Instead, use -v to test if the variable was
set.

Signed-off-by: Omar Sandoval <osandov@fb.com>
common/cgroup

index 48e546fcc943e188fab84b82d5ea4ef3afe3f457..554ebf7ecc086259939e155974e3be7b19d6eec4 100644 (file)
@@ -22,7 +22,7 @@ _init_cgroup2()
 
 _exit_cgroup2()
 {
-       if [[ -n $CGROUP2_DIR ]]; then
+       if [[ -CGROUP2_DIR ]]; then
                find "$CGROUP2_DIR" -type d -delete
                unset CGROUP2_DIR
        fi