From d0ed6dc1464bd4b62b765060901de708eec5687d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 2 Oct 2014 11:56:22 -0700 Subject: [PATCH] Report the system error on why chmod(2) failed in XDG_RUNTIME_DIR This is a very rare occurrence: if the user is the owner of the directory, the user can chmod(2), and we already checked that the user is the owner. However, chmod(2) can still fail on read-only fs and on hardened systems. Task-number: QTBUG-41735 Change-Id: I8f8bac763bf5a6e575ed59dac55bd265e5b66271 Reviewed-by: Oswald Buddenhagen Reviewed-by: David Faure --- src/corelib/io/qstandardpaths_unix.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp index 2d08c1c4e6..2ad6dfa121 100644 --- a/src/corelib/io/qstandardpaths_unix.cpp +++ b/src/corelib/io/qstandardpaths_unix.cpp @@ -136,7 +136,8 @@ QString QStandardPaths::writableLocation(StandardLocation type) const QFile::Permissions wantedPerms = QFile::ReadUser | QFile::WriteUser | QFile::ExeUser | QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner; if (file.permissions() != wantedPerms && !file.setPermissions(wantedPerms)) { - qWarning("QStandardPaths: wrong permissions on runtime directory %s", qPrintable(xdgRuntimeDir)); + qWarning("QStandardPaths: could not set correct permissions on runtime directory %s: %s", + qPrintable(xdgRuntimeDir), qPrintable(file.errorString())); return QString(); } return xdgRuntimeDir;