diff --git a/kdecore/io/klockfile_unix.cpp b/kdecore/io/klockfile_unix.cpp index 2139f01b..83741ba0 100644 --- a/kdecore/io/klockfile_unix.cpp +++ b/kdecore/io/klockfile_unix.cpp @@ -17,6 +17,8 @@ */ #include "klockfile.h" +#include "kglobal.h" +#include "kstandarddirs.h" #include "kdebug.h" #include "kde_file.h" @@ -48,7 +50,8 @@ KLockFilePrivate::KLockFilePrivate() KLockFile::KLockFile(const QString &file) : d(new KLockFilePrivate()) { - d->m_lockfile = QFile::encodeName(file); + d->m_lockfile = QFile::encodeName(KGlobal::dirs()->saveLocation("tmp")); + d->m_lockfile.append(QFile::encodeName(file).toHex()); d->m_lockfile.append(".klockfile"); } @@ -64,11 +67,7 @@ bool KLockFile::tryLock() return true; } -#ifdef O_CLOEXEC - d->m_lockfd = KDE_open(d->m_lockfile.constData(), O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC, 0644); -#else d->m_lockfd = KDE_open(d->m_lockfile.constData(), O_WRONLY | O_CREAT | O_EXCL, 0644); -#endif return (d->m_lockfd != -1); } diff --git a/kdecore/kernel/kauthorization.cpp b/kdecore/kernel/kauthorization.cpp index 3e86b400..98c34acd 100644 --- a/kdecore/kernel/kauthorization.cpp +++ b/kdecore/kernel/kauthorization.cpp @@ -59,12 +59,6 @@ void kAuthMessageHandler(QtMsgType type, const char *msg) } } -static QString kGetLockFile(const QString &helper) -{ - const QString lockdir = KGlobal::dirs()->saveLocation("tmp"); - return lockdir + helper; -} - class KAuthorizationAdaptor: public QDBusAbstractAdaptor { Q_OBJECT @@ -133,7 +127,7 @@ KAuthorization::~KAuthorization() bool KAuthorization::isAuthorized(const QString &helper) { kDebug() << "Checking if" << helper << "is authorized"; - KLockFile authorizationlock(kGetLockFile(helper)); + KLockFile authorizationlock(helper); authorizationlock.lock(); QDBusInterface kauthorizationinterface( helper, QString::fromLatin1("/KAuthorization"), QString::fromLatin1("org.kde.kauthorization"), @@ -152,7 +146,7 @@ bool KAuthorization::isAuthorized(const QString &helper) int KAuthorization::execute(const QString &helper, const QString &method, const QVariantMap &arguments) { kDebug(s_kauthorizationarea) << "Executing" << helper << "method" << method; - KLockFile authorizationlock(kGetLockFile(helper)); + KLockFile authorizationlock(helper); authorizationlock.lock(); QDBusInterface kauthorizationinterface( helper, QString::fromLatin1("/KAuthorization"), QString::fromLatin1("org.kde.kauthorization"), diff --git a/kutils/kpasswdstore/kpasswdstore.cpp b/kutils/kpasswdstore/kpasswdstore.cpp index 2434fc5a..c7197c36 100644 --- a/kutils/kpasswdstore/kpasswdstore.cpp +++ b/kutils/kpasswdstore/kpasswdstore.cpp @@ -19,7 +19,6 @@ #include "kpasswdstore.h" #include "kconfig.h" #include "kconfiggroup.h" -#include "kglobal.h" #include "kstandarddirs.h" #include "klockfile.h" #include "ksettings.h" @@ -47,7 +46,7 @@ static QByteArray getCookie() static QString getLockName(const QByteArray &cookie, const QString &storeid) { - return QString::fromLatin1("%1/%2-%3").arg(KGlobal::dirs()->saveLocation("tmp"), cookie, storeid); + return QString::fromLatin1("%2-%3").arg(cookie, storeid); } class KPasswdStorePrivate