]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1630] fix remove_if_exists not removing a file
authorAndrei Pavel <andrei@isc.org>
Wed, 6 Jan 2021 22:57:49 +0000 (00:57 +0200)
committerAndrei Pavel <andrei@isc.org>
Mon, 11 Jan 2021 09:43:25 +0000 (09:43 +0000)
src/bin/admin/tests/memfile_tests.sh.in
src/lib/testutils/dhcp_test_lib.sh.in

index c5394f43065d34b5484890a04d2994b1c47e1996..c68f3814f09c5118cf28ea70afd26888d6cd7f29 100644 (file)
@@ -23,6 +23,7 @@ set -eu
 kea_admin="@abs_top_builddir@/src/bin/admin/kea-admin"
 kea_lfc="@abs_top_builddir@/src/bin/lfc/kea-lfc"
 
+# Clean up any files used in testing.
 clean_up() {
     remove_if_exists \
         "${config_file-}" \
index c9c93f448a2360b5e34388d8e13810eb21448653..fb5e110fcf3039f29a3b01280b7f47820be538e5 100644 (file)
@@ -551,9 +551,10 @@ get_reconfigs() {
     ${_GET_RECONFIG_ERRORS##*[! ]}
 }
 
+# Remove the given directories or files if they exist.
 remove_if_exists() {
-    while test ${#} -gt 1; do
-        if test -n "${1}"; then
+    while test ${#} -gt 0; do
+        if test -e "${1}"; then
             rm -rf "${1}"
         fi
         shift