From 0fba60818b881c67048748baf07d89c6e9a2538b Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Sat, 20 Nov 2004 00:41:08 +0000 Subject: [PATCH] Do not emit a spurious warning when "directory" argument to "rmdir -p" is absolute, with one or more leading slash. --- bin/rmdir/rmdir.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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);