[hackers] [sbase] rm: Don't ask for confirmation to remove symlinks || Michael Forney
commit c546c3a5724c81cee9a11d816a38ccdf17472129
Author: Michael Forney <mforney_AT_mforney.org>
AuthorDate: Fri May 22 10:55:39 2026 -0700
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.net>
CommitDate: Mon May 25 09:04:36 2026 +0200
rm: Don't ask for confirmation to remove symlinks
faccessat traverses symlinks, and does not support AT_SYMLINK_NOFOLLOW
in POSIX.
diff --git a/libutil/rm.c b/libutil/rm.c
index 08845f4..ff4afeb 100644
--- a/libutil/rm.c
+++ b/libutil/rm.c
_AT_@ -19,7 +19,7 @@ rm(int dirfd, const char *name, struct stat *st, void *data, struct recursor *r)
ignore = r->flags & IGNORE;
quiet = r->flags & SILENT;
ask = r->flags & CONFIRM;
- write = faccessat(dirfd, name, W_OK, 0) == 0;
+ write = S_ISLNK(st->st_mode) || faccessat(dirfd, name, W_OK, 0) == 0;
flags = 0;
if (S_ISDIR(st->st_mode) && r->maxdepth) {
Received on Mon May 25 2026 - 09:04:51 CEST
This archive was generated by hypermail 2.3.0
: Mon May 25 2026 - 09:12:36 CEST