Commit fc2fcacf authored by Thiago Macieira's avatar Thiago Macieira
Browse files

Don't always chmod the XDG_RUNTIME_DIR


Since the current user is the owner of the dir, we'll get 0x7700 as
permissions, not just 0x700. With the wrong check, we were always doing
an unnecessary chmod.

Task-number: QTBUG-41735
Change-Id: Ib1fc258fef4bf526baa9c71201f9b78d36f5454f
Reviewed-by: default avatarDavid Faure <david.faure@kdab.com>
parent 85da1625
Branches
Tags
No related merge requests found
Showing with 3 additions and 1 deletion
......@@ -131,8 +131,10 @@ QString QStandardPaths::writableLocation(StandardLocation type)
return QString();
}
// "and he MUST be the only one having read and write access to it. Its Unix access mode MUST be 0700."
// since the current user is the owner, set both xxxUser and xxxOwner
QFile file(xdgRuntimeDir);
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;
if (file.permissions() != wantedPerms && !file.setPermissions(wantedPerms)) {
qWarning("QStandardPaths: wrong permissions on runtime directory %s", qPrintable(xdgRuntimeDir));
return QString();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment