From df7803072896ac3845bbac40b98cfed61985d145 Mon Sep 17 00:00:00 2001 From: Sevan Janiyan Date: Sun, 4 Nov 2018 14:40:04 +0000 Subject: [PATCH] bin/rmdir: sync with NetBSD-8 NetBSD PR/48182: Fix rmdir -p handling of top-level (root) directory. closes #272 Change-Id: I5a69ac84ca236ca03feea49dc9c84537147c2d65 --- bin/rmdir/rmdir.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/rmdir/rmdir.c b/bin/rmdir/rmdir.c index 03261ced5..ab884b2dd 100644 --- a/bin/rmdir/rmdir.c +++ b/bin/rmdir/rmdir.c @@ -1,4 +1,4 @@ -/* $NetBSD: rmdir.c,v 1.26 2011/08/29 14:49:38 joerg Exp $ */ +/* $NetBSD: rmdir.c,v 1.26.36.1 2017/08/14 23:54:30 snj Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993, 1994\ #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.26.36.1 2017/08/14 23:54:30 snj Exp $"); #endif #endif /* not lint */ @@ -103,6 +103,10 @@ rm_path(char *path) /* Ignore trailing '/' on deleted name */ continue; + if (*path == 0) + /* At top level (root) directory */ + break; + if (rmdir(path) < 0) { warn("%s", path); return (1); -- 2.44.0