summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--tdecore/ktempfile.cpp8
-rw-r--r--tdecore/tdehardwaredevices.cpp18
-rw-r--r--tdecore/tdehardwaredevices.h3
3 files changed, 25 insertions, 4 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);
diff --git a/tdecore/tdehardwaredevices.cpp b/tdecore/tdehardwaredevices.cpp
index 38b68d198..083d82bbc 100644
--- a/tdecore/tdehardwaredevices.cpp
+++ b/tdecore/tdehardwaredevices.cpp
@@ -1876,7 +1876,7 @@ void TDEHardwareDevices::processHotPluggedHardware() {
break;
}
}
-
+
if (device) {
m_deviceList.append(device);
updateParentDeviceInformation(device); // Update parent/child tables for this device
@@ -2406,6 +2406,9 @@ TDEGenericDeviceType::TDEGenericDeviceType readGenericDeviceTypeFromString(TQStr
else if (query == "HID") {
ret = TDEGenericDeviceType::HID;
}
+ else if (query == "Modem") {
+ ret = TDEGenericDeviceType::Modem;
+ }
else if (query == "Monitor") {
ret = TDEGenericDeviceType::Monitor;
}
@@ -3154,6 +3157,8 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
}
}
// Post PCI 2.0
+ TQString devicepcisubclass = devicepciclass;
+ devicepcisubclass = devicepcisubclass.remove(0,2);
if (devicepciclass.startsWith("01")) {
if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::StorageController);
}
@@ -3177,6 +3182,11 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
if (devicepciclass.startsWith("06")) {
if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Bridge);
}
+ if (devicepciclass.startsWith("07")) {
+ if (devicepcisubclass.startsWith("03")) {
+ if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Modem);
+ }
+ }
if (devicepciclass.startsWith("0a")) {
if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Dock);
}
@@ -4885,6 +4895,9 @@ TQString TDEHardwareDevices::getFriendlyDeviceTypeStringFromType(TDEGenericDevic
else if (query == TDEGenericDeviceType::HID) {
ret = i18n("HID");
}
+ else if (query == TDEGenericDeviceType::Modem) {
+ ret = i18n("Modem");
+ }
else if (query == TDEGenericDeviceType::Monitor) {
ret = i18n("Monitor and Display");
}
@@ -5034,6 +5047,9 @@ TQPixmap TDEHardwareDevices::getDeviceTypeIconFromType(TDEGenericDeviceType::TDE
else if (query == TDEGenericDeviceType::HID) {
ret = DesktopIcon("kcmdevices", size); // FIXME
}
+ else if (query == TDEGenericDeviceType::Modem) {
+ ret = DesktopIcon("kcmpci", size);
+ }
else if (query == TDEGenericDeviceType::Monitor) {
ret = DesktopIcon("background", size);
}
diff --git a/tdecore/tdehardwaredevices.h b/tdecore/tdehardwaredevices.h
index 9986dda89..db94b31cc 100644
--- a/tdecore/tdehardwaredevices.h
+++ b/tdecore/tdehardwaredevices.h
@@ -57,6 +57,7 @@ enum TDEGenericDeviceType {
Mouse,
Keyboard,
HID,
+ Modem,
Monitor,
Network,
Printer,
@@ -2031,4 +2032,4 @@ class TDECORE_EXPORT TDEHardwareDevices : public TQObject
friend class TDECPUDevice;
};
-#endif \ No newline at end of file
+#endif