summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eval.c5
-rwxr-xr-xtests.sh7
2 files changed, 11 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index 34343d4..1e88a93 100644
--- a/eval.c
+++ b/eval.c
@@ -243,6 +243,11 @@ bool eval_uid(const struct expr *expr, struct eval_state *state) {
bool eval_delete(const struct expr *expr, struct eval_state *state) {
struct BFTW *ftwbuf = state->ftwbuf;
+ // Don't try to delete the current directory
+ if (strcmp(ftwbuf->path, ".") == 0) {
+ return true;
+ }
+
int flag = 0;
if (ftwbuf->typeflag == BFTW_DIR) {
flag |= AT_REMOVEDIR;
diff --git a/tests.sh b/tests.sh
index cf39fd6..d9ee9c9 100755
--- a/tests.sh
+++ b/tests.sh
@@ -448,7 +448,12 @@ function test_0081() {
find_diff "$basic/" -depth
}
-for i in {1..81}; do
+function test_0082() {
+ # Don't try to delete .
+ (cd "$scratch" && "$BFS" -delete)
+}
+
+for i in {1..82}; do
test="test_$(printf '%04d' $i)"
if [ -t 1 ]; then