Do not emit a spurious warning when "directory" argument

to "rmdir -p" is absolute, with one or more leading slash.
This commit is contained in:
Ruslan Ermilov 2004-11-20 00:41:08 +00:00
parent d4af5f3250
commit 0fba60818b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=137902

View File

@ -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);