Introduction
Introduction Statistics Contact Development Disclaimer Help
rm: Fix regression from b278710 - sbase - suckless unix tools
git clone git://git.suckless.org/sbase
Log
Files
Refs
README
LICENSE
---
commit cfe9424ba92c735613723ab18427d091f825de34
parent b27871013b1debede7a5177f915be3f7b75aaee3
Author: Roberto E. Vargas Caballero <[email protected]>
Date: Fri, 2 May 2025 10:41:35 +0200
rm: Fix regression from b278710
The forbidden() function only checks if we are trying to remove one of
the . .. or / directories that are forbidden by POSIX, and it should
not fail when it cannot stat a target, because that check is done later
considering if -r, -f and -i were used or not. If the stat fails we can
be sure that is not / and thus it is not a forbidden target.
Diffstat:
M rm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/rm.c b/rm.c
@@ -33,7 +33,7 @@ forbidden(char *path, struct stat *root)
}
if (stat(path, &st) < 0)
- eprintf("stat argument '%s':", path);
+ return 0;
if (st.st_dev == root->st_dev && st.st_ino == root->st_ino) {
if (!w2)
weprintf("\"/\" may not be removed\n");
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.