diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-05-25 22:21:55 -0500 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2012-06-02 19:05:46 +0200 |
commit | 9a37f39d564efcaf2461c55406e099ad31a8e3fa (patch) | |
tree | 021b7af79aef96c78c76477a8177e4d3027d6809 /kdecore | |
parent | 89bb0f332979b86d3d6cca1b6efb623cc8ae9564 (diff) | |
download | tdelibs-9a37f39d564efcaf2461c55406e099ad31a8e3fa.tar.gz tdelibs-9a37f39d564efcaf2461c55406e099ad31a8e3fa.zip |
Fix KTempFile not obeying special bits on file creation
This closes Bug 349
(cherry picked from commit 9068fffdf82dc9cf60e83639b3a9b397761304cd)
Diffstat (limited to 'kdecore')
-rw-r--r-- | kdecore/ktempfile.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/kdecore/ktempfile.cpp b/kdecore/ktempfile.cpp index f439b55ef..b745bbf57 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); |