[Rpm-maint] [PATCH] Revert "If there are no hardlinks, dont bother with s-bit and caps removal"
Michal Schmidt
mschmidt at redhat.com
Tue Jun 22 13:51:41 UTC 2010
Deciding whether it is necessary to remove the SUID bit based on
the current link count creates an opportunity for a race condition.
A hardlink could be created just between lstat() and chmod().
This reverts commit 89be57ad9239c9ada0cba94a5003876b456d46bf.
---
lib/fsm.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/fsm.c b/lib/fsm.c
index 2d972f3..068c65d 100644
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -1264,7 +1264,7 @@ static int fsmMkdirs(FSM_t fsm)
static void removeSBITS(const char *path)
{
struct stat stb;
- if (lstat(path, &stb) == 0 && S_ISREG(stb.st_mode) && stb.st_nlink > 1) {
+ if (lstat(path, &stb) == 0 && S_ISREG(stb.st_mode)) {
if ((stb.st_mode & 06000) != 0) {
(void) chmod(path, stb.st_mode & 0777);
}
More information about the Rpm-maint
mailing list