summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-11-13 21:30:48 -0500
committerTavian Barnes <tavianator@tavianator.com>2016-11-13 21:42:29 -0500
commit196cf9f617ca17acec75eafbcd9e5e7989752dcb (patch)
tree2240fb256e83c9bca18bed43591f6c2800c6a42a /eval.c
parentf63aa21beaffbb8da4978bfa37f070170cb8122e (diff)
downloadbfs-196cf9f617ca17acec75eafbcd9e5e7989752dcb.tar.xz
Don't try to -delete the current directory.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c5
1 files changed, 5 insertions, 0 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;