[hackers] [sbase] rm: Fix regression from b278710 || Roberto E. Vargas Caballero
commit cfe9424ba92c735613723ab18427d091f825de34
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Fri May 2 10:41:35 2025 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri May 2 10:41:35 2025 +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.
diff --git a/rm.c b/rm.c
index fd13b22..3adfc8c 100644
--- a/rm.c
+++ b/rm.c
_AT_@ -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");
Received on Fri May 02 2025 - 10:46:52 CEST
This archive was generated by hypermail 2.3.0
: Fri May 02 2025 - 10:48:39 CEST