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:
parent
f5e118fbbd
commit
339fc9c24a
@ -103,9 +103,11 @@ rm_path(char *path)
|
|||||||
*++p = '\0';
|
*++p = '\0';
|
||||||
while ((p = strrchr(path, '/')) != NULL) {
|
while ((p = strrchr(path, '/')) != NULL) {
|
||||||
/* Delete trailing slashes. */
|
/* Delete trailing slashes. */
|
||||||
while (--p > path && *p == '/')
|
while (--p >= path && *p == '/')
|
||||||
;
|
;
|
||||||
*++p = '\0';
|
*++p = '\0';
|
||||||
|
if (p == path)
|
||||||
|
break;
|
||||||
|
|
||||||
if (rmdir(path) < 0) {
|
if (rmdir(path) < 0) {
|
||||||
warn("%s", path);
|
warn("%s", path);
|
||||||
|
Loading…
Reference in New Issue
Block a user