summaryrefslogtreecommitdiffstats
path: root/tdecore/ktempfile.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-05-25 22:21:55 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-05-25 22:21:55 -0500
commit9068fffdf82dc9cf60e83639b3a9b397761304cd (patch)
treef020c203254e592de74da69c46a7a37a7021029d /tdecore/ktempfile.cpp
parent41ea89f79d28c456b296e8ddcce0a12c21e13f94 (diff)
downloadtdelibs-9068fffdf82dc9cf60e83639b3a9b397761304cd.tar.gz
tdelibs-9068fffdf82dc9cf60e83639b3a9b397761304cd.zip
Fix KTempFile not obeying special bits on file creation
This closes Bug 349 Add modem category to TDE hardware manager
Diffstat (limited to 'tdecore/ktempfile.cpp')
-rw-r--r--tdecore/ktempfile.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/tdecore/ktempfile.cpp b/tdecore/ktempfile.cpp
index 2c7b56e79..4632f0053 100644
--- a/tdecore/ktempfile.cpp
+++ b/tdecore/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);