summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/rm/rm.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/bin/rm/rm.c b/bin/rm/rm.c
index 5d6b46622a1..436b70068a1 100644
--- a/bin/rm/rm.c
+++ b/bin/rm/rm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rm.c,v 1.24 2012/06/18 00:33:47 millert Exp $ */
+/* $OpenBSD: rm.c,v 1.25 2012/06/18 01:03:05 guenther Exp $ */
/* $NetBSD: rm.c,v 1.19 1995/09/07 06:48:50 jtc Exp $ */
/*-
@@ -198,9 +198,13 @@ rm_tree(char **argv)
continue;
break;
- default:
+ case FTS_F:
+ case FTS_NSOK:
if (Pflag)
- rm_overwrite(p->fts_accpath, NULL);
+ rm_overwrite(p->fts_accpath, p->fts_info ==
+ FTS_NSOK ? NULL : p->fts_statp);
+ /* FALLTHROUGH */
+ default:
if (!unlink(p->fts_accpath) ||
(fflag && errno == ENOENT))
continue;