blob: 7f21fe1761ec799be33dea673fd576f564d1d6d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
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);
|