Ticket #46496: Don-t-always-chmod-the-XDG_RUNTIME_DIR.patch

File Don-t-always-chmod-the-XDG_RUNTIME_DIR.patch, 1.5 KB (added by RJVB (René Bertin), 10 years ago)

from Ubuntu

  • qtbase/src/corelib/io/qstandardpaths_unix.cpp

    From 5f6d7003c4be42477c92b79b7eb73272c31b1585 Mon Sep 17 00:00:00 2001
    From: Thiago Macieira <thiago.macieira@intel.com>
    Date: Thu, 2 Oct 2014 11:49:55 -0700
    Subject: [PATCH] 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
    ---
     src/corelib/io/qstandardpaths_unix.cpp | 4 +++-
     1 file changed, 3 insertions(+), 1 deletion(-)
    
     
    138138            return QString();
    139139        }
    140140        // "and he MUST be the only one having read and write access to it. Its Unix access mode MUST be 0700."
     141        // since the current user is the owner, set both xxxUser and xxxOwner
    141142        QFile file(xdgRuntimeDir);
    142         const QFile::Permissions wantedPerms = QFile::ReadUser | QFile::WriteUser | QFile::ExeUser;
     143        const QFile::Permissions wantedPerms = QFile::ReadUser | QFile::WriteUser | QFile::ExeUser
     144                                               | QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner;
    143145        if (file.permissions() != wantedPerms && !file.setPermissions(wantedPerms)) {
    144146            qWarning("QStandardPaths: wrong permissions on runtime directory %s", qPrintable(xdgRuntimeDir));
    145147            return QString();