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 <oswald.buddenhagen@theqtcompany.com> Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
parent
fc2fcacfcc
commit
d0ed6dc146
@ -136,7 +136,8 @@ QString QStandardPaths::writableLocation(StandardLocation type)
|
|||||||
const QFile::Permissions wantedPerms = QFile::ReadUser | QFile::WriteUser | QFile::ExeUser
|
const QFile::Permissions wantedPerms = QFile::ReadUser | QFile::WriteUser | QFile::ExeUser
|
||||||
| QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner;
|
| QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner;
|
||||||
if (file.permissions() != wantedPerms && !file.setPermissions(wantedPerms)) {
|
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 QString();
|
||||||
}
|
}
|
||||||
return xdgRuntimeDir;
|
return xdgRuntimeDir;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user