aboutsummaryrefslogtreecommitdiff
path: root/bin/rmdir
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>1997-12-19 20:20:22 +0000
committerBruce Evans <bde@FreeBSD.org>1997-12-19 20:20:22 +0000
commit8e9c31e830b733b4d2e4c34587a2c6bf081d489d (patch)
tree91dcb593b04f81d337edffa5cbae3e4158bd5a70 /bin/rmdir
parentf3a4092ca2fe11cadc4c6fa4e519c1156d1e1055 (diff)
downloadsrc-8e9c31e830b733b4d2e4c34587a2c6bf081d489d.tar.gz
src-8e9c31e830b733b4d2e4c34587a2c6bf081d489d.zip
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.
Notes
Notes: svn path=/head/; revision=31862
Diffstat (limited to 'bin/rmdir')
-rw-r--r--bin/rmdir/rmdir.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/bin/rmdir/rmdir.c b/bin/rmdir/rmdir.c
index 89672926b510..d6d13471d323 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;