diff options
Diffstat (limited to 'tdecore/ktempfile.cpp')
-rw-r--r-- | tdecore/ktempfile.cpp | 8 |
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); |