26 lines
940 B
Diff
26 lines
940 B
Diff
commit 26874707edfe73e153383284f9fe33cfd9879bb1
|
|
Author: Michal Schmidt <mschmidt@redhat.com>
|
|
Date: Tue Jun 22 15:51:41 2010 +0200
|
|
|
|
Revert "If there are no hardlinks, dont bother with s-bit and caps removal"
|
|
|
|
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.
|
|
|
|
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);
|
|
}
|