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 89be57ad92.
This commit is contained in:
Michal Schmidt 2010-06-22 15:51:41 +02:00 committed by Panu Matilainen
parent 7583fcc341
commit 26874707ed
1 changed files with 1 additions and 1 deletions

View File

@ -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);
}