diff options
author | bde <bde@FreeBSD.org> | 1997-12-19 20:20:22 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1997-12-19 20:20:22 +0000 |
commit | d102d16ab7c67b79b30848579f84f59af4e5ccfb (patch) | |
tree | 7519d0a711637680bb729f75f1a4e290a51013f5 | |
parent | ae9996d766fc83a1fba5e030badadbe6d6a64ad6 (diff) | |
download | FreeBSD-src-d102d16ab7c67b79b30848579f84f59af4e5ccfb.zip FreeBSD-src-d102d16ab7c67b79b30848579f84f59af4e5ccfb.tar.gz |
Don't strip trailing slashes (for the initial rmdir). It breaks
following of the symlink for `rmdir symlink/' and is unnecessary
for ordinary directories (POSIX doesn't require rmdir(1) to do
anything for trailing slashes; it requires rmdir(2) to let them
"refer to a directory", and following the symlink for symlink/ is
what BSD does). This also fixes bugs in the slash-stripping code
(for paths consisting entirely of slashes, the pointer into the
string was decremented to "before" the beginning of the string,
and the path was at best stripped to "".
The behaviour is unchanged except for the final directory for
`rmdir -p ...'. There is no alternative to stripping intermediate
slashes since they must be specified. The sloppy slash-stripping
code is adequate for intermediate directories, since the all-slashes
case fails early.
-rw-r--r-- | bin/rmdir/rmdir.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/bin/rmdir/rmdir.c b/bin/rmdir/rmdir.c index 8967292..d6d1347 100644 --- a/bin/rmdir/rmdir.c +++ b/bin/rmdir/rmdir.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: rmdir.c,v 1.5 1997/02/22 14:05:40 peter Exp $ + * $Id: rmdir.c,v 1.6 1997/03/28 15:24:37 imp Exp $ */ #ifndef lint @@ -78,14 +78,6 @@ main(argc, argv) usage(); for (errors = 0; *argv; argv++) { - char *p; - - /* Delete trailing slashes, per POSIX. */ - p = *argv + strlen(*argv); - while (--p > *argv && *p == '/') - ; - *++p = '\0'; - if (rmdir(*argv) < 0) { warn("%s", *argv); errors = 1; |