tde-packaging/redhat/tdelibs/kdelibs-3.5.13-fix_ktempfil...

28 lines
867 B

commit 9068fffdf82dc9cf60e83639b3a9b397761304cd
Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>
Date: 1338002515 -0500
Fix KTempFile not obeying special bits on file creation
This closes Bug 349
Add modem category to TDE hardware manager
diff --git a/tdecore/ktempfile.cpp b/tdecore/ktempfile.cpp
index 2c7b56e..4632f00 100644
--- a/kdecore/ktempfile.cpp
+++ b/kdecore/ktempfile.cpp
@@ -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);