diff options
author | ru <ru@FreeBSD.org> | 2004-11-20 00:41:08 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2004-11-20 00:41:08 +0000 |
commit | 339fc9c24a395f116b20424910d55c5acadb414e (patch) | |
tree | 07f2a909e9278bad9dbdefd08cdb323aa7b61042 /bin/rmdir | |
parent | f5e118fbbd40e458a630d053352692c743f73b25 (diff) | |
download | FreeBSD-src-339fc9c24a395f116b20424910d55c5acadb414e.zip FreeBSD-src-339fc9c24a395f116b20424910d55c5acadb414e.tar.gz |
Do not emit a spurious warning when "directory" argument
to "rmdir -p" is absolute, with one or more leading slash.
Diffstat (limited to 'bin/rmdir')
-rw-r--r-- | bin/rmdir/rmdir.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/rmdir/rmdir.c b/bin/rmdir/rmdir.c index 85dfde1..87167ec 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); |