summaryrefslogtreecommitdiffstats
path: root/bin/rmdir
diff options
context:
space:
mode:
authornbm <nbm@FreeBSD.org>2000-06-28 14:54:07 +0000
committernbm <nbm@FreeBSD.org>2000-06-28 14:54:07 +0000
commitce68da90ca9d1cc533704542a9be355c2fffa434 (patch)
tree3e6c1a9171daa8eb39c6ef2bffb21627dbee90dd /bin/rmdir
parentc328bb90a7d8a1f4d56302759d68d581ffef5666 (diff)
downloadFreeBSD-src-ce68da90ca9d1cc533704542a9be355c2fffa434.zip
FreeBSD-src-ce68da90ca9d1cc533704542a9be355c2fffa434.tar.gz
Fix the rmdir -p a/b/c/ case, where rmdir -p a/b/c works, and rmdir c/
works. PR: PR 6521 Submitted by: Rudolf Cejka <xcejka00@dcse.fee.vutbr.cz> Reviewed by: eivind (in brief retrograde)
Diffstat (limited to 'bin/rmdir')
-rw-r--r--bin/rmdir/rmdir.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/bin/rmdir/rmdir.c b/bin/rmdir/rmdir.c
index 4be8427..5c16c3d 100644
--- a/bin/rmdir/rmdir.c
+++ b/bin/rmdir/rmdir.c
@@ -96,6 +96,10 @@ rm_path(path)
{
char *p;
+ p = path + strlen(path);
+ while (--p > path && *p == '/')
+ ;
+ *++p = '\0';
while ((p = strrchr(path, '/')) != NULL) {
/* Delete trailing slashes. */
while (--p > path && *p == '/')
OpenPOWER on IntegriCloud