summaryrefslogtreecommitdiffstats
path: root/usr.bin/find/function.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/find/function.c')
-rw-r--r--usr.bin/find/function.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c
index 7f16a8f..56d361c 100644
--- a/usr.bin/find/function.c
+++ b/usr.bin/find/function.c
@@ -442,7 +442,8 @@ f_delete(PLAN *plan __unused, FTSENT *entry)
errx(1, "-delete: forbidden when symlinks are followed");
/* Potentially unsafe - do not accept relative paths whatsoever */
- if (strchr(entry->fts_accpath, '/') != NULL)
+ if (entry->fts_level > FTS_ROOTLEVEL &&
+ strchr(entry->fts_accpath, '/') != NULL)
errx(1, "-delete: %s: relative path potentially not safe",
entry->fts_accpath);
OpenPOWER on IntegriCloud