Fix KTempFile not obeying special bits on file creation

This closes Bug 349
(cherry picked from commit 9068fffdf8)
v3.5.13-sru
Timothy Pearson 12 years ago committed by Slávek Banko
parent 89bb0f3329
commit 9a37f39d56

@ -117,8 +117,12 @@ KTempFile::create(const TQString &filePrefix, const TQString &fileExtension,
// Success!
bOpen = true;
// Set uid/gid (necessary for SUID programs)
fchown(mFd, getuid(), getgid());
uid_t uid = getuid();
uid_t euid = geteuid();
if (uid != euid) {
// Set uid/gid (necessary for SUID programs)
fchown(mFd, getuid(), getgid());
}
// Set close on exec
fcntl(mFd, F_SETFD, FD_CLOEXEC);

Loading…
Cancel
Save