summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Koller <[email protected]>2018-04-11 16:49:16 +0200
committerMartin Koller <[email protected]>2018-04-12 21:23:49 +0200
commitba213f330650d830f5fbd9963f98a312b9902525 (patch)
tree0c204536c7f9888b945aabaedbc745fbb2f6013f
parent85ba0b07054c03f3dadaefdd30ab346d082f5629 (diff)
make sure to create unique filename in maildir resourcev18.04.0
Differential Revision: https://phabricator.kde.org/D12019 (cherry picked from commit e681e74f6a4e2e1dc67b2714a949c6e188a15d73)
-rw-r--r--resources/maildir/libmaildir/maildir.cpp27
1 files changed, 1 insertions, 26 deletions
diff --git a/resources/maildir/libmaildir/maildir.cpp b/resources/maildir/libmaildir/maildir.cpp
index 3159c4e..f891a29 100644
--- a/resources/maildir/libmaildir/maildir.cpp
+++ b/resources/maildir/libmaildir/maildir.cpp
@@ -36,27 +36,6 @@
//Define it to get more debug output to expense of operating speed
// #define DEBUG_KEYCACHE_CONSITENCY
-static void initRandomSeed()
-{
- static bool init = false;
- if (!init) {
- unsigned int seed;
- init = true;
- int fd = ::open("/dev/urandom", O_RDONLY);
- if (fd < 0 || ::read(fd, &seed, sizeof(seed)) != sizeof(seed)) {
- // No /dev/urandom... try something else.
- srand(QCoreApplication::applicationPid());
- seed = rand() + time(nullptr);
- }
-
- if (fd >= 0) {
- close(fd);
- }
-
- qsrand(seed);
- }
-}
-
using namespace KPIM;
static QRegularExpression statusSeparatorRx()
@@ -73,10 +52,6 @@ public:
, isRoot(isRoot)
{
hostName = QHostInfo::localHostName();
- // The default implementation of QUuid::createUuid() doesn't use
- // a seed that is random enough. Therefor we use our own initialization
- // until this issue will be fixed in Qt 4.7.
- initRandomSeed();
//Cache object is created the first time this runs.
//It will live throughout the lifetime of the application
@@ -574,7 +549,7 @@ QByteArray Maildir::readEntryHeaders(const QString &key) const
static QString createUniqueFileName()
{
- const qint64 time = QDateTime::currentSecsSinceEpoch();
+ const qint64 time = QDateTime::currentMSecsSinceEpoch();
const int r = qrand() % 1000;
const QString identifier = QLatin1String("R") + QString::number(r);