Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/rmdir PR/48182: Fix rmdir -p handling of top-level (root...



details:   https://anonhg.NetBSD.org/src/rev/54d69c5dcd33
branches:  trunk
changeset: 355712:54d69c5dcd33
user:      ginsbach <ginsbach%NetBSD.org@localhost>
date:      Thu Aug 10 22:52:13 2017 +0000

description:
PR/48182: Fix rmdir -p handling of top-level (root) directory.
XXX: pullup-8
XXX: pullup-7
XXX: pullup-6

diffstat:

 bin/rmdir/rmdir.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 9f1fe8684af3 -r 54d69c5dcd33 bin/rmdir/rmdir.c
--- a/bin/rmdir/rmdir.c Thu Aug 10 21:07:48 2017 +0000
+++ b/bin/rmdir/rmdir.c Thu Aug 10 22:52:13 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rmdir.c,v 1.26 2011/08/29 14:49:38 joerg Exp $ */
+/* $NetBSD: rmdir.c,v 1.27 2017/08/10 22:52:13 ginsbach Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993, 1994
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)rmdir.c    8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: rmdir.c,v 1.26 2011/08/29 14:49:38 joerg Exp $");
+__RCSID("$NetBSD: rmdir.c,v 1.27 2017/08/10 22:52:13 ginsbach Exp $");
 #endif
 #endif /* not lint */
 
@@ -103,6 +103,10 @@
                        /* Ignore trailing '/' on deleted name */
                        continue;
 
+               if (*path == 0)
+                       /* At top level (root) directory */
+                       break;
+
                if (rmdir(path) < 0) {
                        warn("%s", path);
                        return (1);



Home | Main Index | Thread Index | Old Index