summaryrefslogtreecommitdiffstats
path: root/tdecore/tdehw/tderootsystemdevice.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-08-26 10:32:41 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-08-26 10:32:41 -0500
commit9d76cb942d54c5e8edec59d90644326219b1c4a0 (patch)
tree5f4a5474c61c923e4bbffae76ed082ae4605c452 /tdecore/tdehw/tderootsystemdevice.cpp
parentcb9c3ed914b0b1578a3fcaea3e35add08cc0bdfb (diff)
downloadtdelibs-9d76cb942d54c5e8edec59d90644326219b1c4a0.tar.gz
tdelibs-9d76cb942d54c5e8edec59d90644326219b1c4a0.zip
Disable suspend/hibernate if $HOME is a network file system
This resolves Bug 1615
Diffstat (limited to 'tdecore/tdehw/tderootsystemdevice.cpp')
-rw-r--r--tdecore/tdehw/tderootsystemdevice.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/tdecore/tdehw/tderootsystemdevice.cpp b/tdecore/tdehw/tderootsystemdevice.cpp
index 86a92340c..3f12b4d5a 100644
--- a/tdecore/tdehw/tderootsystemdevice.cpp
+++ b/tdecore/tdehw/tderootsystemdevice.cpp
@@ -18,6 +18,7 @@
*/
#include "tderootsystemdevice.h"
+#include "tdestoragedevice.h"
#include <unistd.h>
@@ -27,6 +28,7 @@
#include "tdeglobal.h"
#include "tdeconfig.h"
#include "tdeapplication.h"
+#include "kstandarddirs.h"
#include "config.h"
@@ -38,6 +40,16 @@
#include <tqdbusconnection.h>
#endif // defined(WITH_TDEHWLIB_DAEMONS) || defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER) || defined(WITH_HAL) || defined(WITH_CONSOLEKIT)
+bool isNetworkFileSystem(TQString fileSystemType) {
+ if ((fileSystemType.startsWith("nfs"))
+ || (fileSystemType == "cifs")
+ ) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
TDERootSystemDevice::TDERootSystemDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn) : TDEGenericDevice(dt, dn) {
m_hibernationSpace = -1;
}
@@ -97,6 +109,12 @@ bool TDERootSystemDevice::canSetHibernationMethod() {
}
bool TDERootSystemDevice::canStandby() {
+ // Network file systems mounted on $HOME typically cause nasty suspend/resume failures
+ // See Bug 1615 for details
+ if (isNetworkFileSystem(TDEStorageDevice::determineFileSystemType(TDEGlobal::dirs()->localtdedir()))) {
+ return FALSE;
+ }
+
TQString statenode = "/sys/power/state";
int rval = access (statenode.ascii(), W_OK);
if (rval == 0) {
@@ -125,9 +143,17 @@ bool TDERootSystemDevice::canStandby() {
}
}
#endif // WITH_TDEHWLIB_DAEMONS
+
+ return FALSE;
}
bool TDERootSystemDevice::canSuspend() {
+ // Network file systems mounted on $HOME typically cause nasty suspend/resume failures
+ // See Bug 1615 for details
+ if (isNetworkFileSystem(TDEStorageDevice::determineFileSystemType(TDEGlobal::dirs()->localtdedir()))) {
+ return FALSE;
+ }
+
TQString statenode = "/sys/power/state";
int rval = access (statenode.ascii(), W_OK);
if (rval == 0) {
@@ -223,6 +249,12 @@ bool TDERootSystemDevice::canSuspend() {
}
bool TDERootSystemDevice::canHibernate() {
+ // Network file systems mounted on $HOME typically cause nasty suspend/resume failures
+ // See Bug 1615 for details
+ if (isNetworkFileSystem(TDEStorageDevice::determineFileSystemType(TDEGlobal::dirs()->localtdedir()))) {
+ return FALSE;
+ }
+
TQString statenode = "/sys/power/state";
int rval = access (statenode.ascii(), W_OK);
if (rval == 0) {