aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@FreeBSD.org>2004-11-20 00:41:08 +0000
committerRuslan Ermilov <ru@FreeBSD.org>2004-11-20 00:41:08 +0000
commit0fba60818b881c67048748baf07d89c6e9a2538b (patch)
tree07f2a909e9278bad9dbdefd08cdb323aa7b61042 /bin
parentd4af5f325030eae72bb7c6c54592e02b1b8f7af0 (diff)
downloadsrc-0fba60818b881c67048748baf07d89c6e9a2538b.tar.gz
src-0fba60818b881c67048748baf07d89c6e9a2538b.zip
Do not emit a spurious warning when "directory" argument
to "rmdir -p" is absolute, with one or more leading slash.
Notes
Notes: svn path=/head/; revision=137902
Diffstat (limited to 'bin')
-rw-r--r--bin/rmdir/rmdir.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/rmdir/rmdir.c b/bin/rmdir/rmdir.c
index 85dfde140b1e..87167ece6b6b 100644
--- a/bin/rmdir/rmdir.c
+++ b/bin/rmdir/rmdir.c
@@ -103,9 +103,11 @@ rm_path(char *path)
*++p = '\0';
while ((p = strrchr(path, '/')) != NULL) {
/* Delete trailing slashes. */
- while (--p > path && *p == '/')
+ while (--p >= path && *p == '/')
;
*++p = '\0';
+ if (p == path)
+ break;
if (rmdir(path) < 0) {
warn("%s", path);