mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 10:52:49 +00:00
kdecore: use QCryptographicHash::hash() to make lock name
converting the file to hex can result in way too long file name and infinite loop in KLockFile::lock() Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
96de1ec99f
commit
88394f1a7f
1 changed files with 2 additions and 1 deletions
|
@ -22,6 +22,7 @@
|
||||||
#include "kdebug.h"
|
#include "kdebug.h"
|
||||||
#include "kde_file.h"
|
#include "kde_file.h"
|
||||||
|
|
||||||
|
#include <QCryptographicHash>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
|
@ -51,7 +52,7 @@ KLockFile::KLockFile(const QString &file)
|
||||||
: d(new KLockFilePrivate())
|
: d(new KLockFilePrivate())
|
||||||
{
|
{
|
||||||
d->m_lockfile = QFile::encodeName(KGlobal::dirs()->saveLocation("tmp"));
|
d->m_lockfile = QFile::encodeName(KGlobal::dirs()->saveLocation("tmp"));
|
||||||
d->m_lockfile.append(QFile::encodeName(file).toHex());
|
d->m_lockfile.append(QCryptographicHash::hash(QFile::encodeName(file), QCryptographicHash::KAT).toHex());
|
||||||
d->m_lockfile.append(".klockfile");
|
d->m_lockfile.append(".klockfile");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue