PR/48182: Fix rmdir -p handling of top-level (root) directory.

XXX: pullup-8
XXX: pullup-7
XXX: pullup-6
This commit is contained in:
ginsbach 2017-08-10 22:52:13 +00:00
parent f20013011f
commit 6066c254d7
1 changed files with 6 additions and 2 deletions

View File

@ -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 @@ __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.27 2017/08/10 22:52:13 ginsbach 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);