Fix race condition allowing to run several instances of qBittorrent at the same time

This commit is contained in:
Christophe Dumez 2010-06-09 09:48:14 +00:00
parent 7ab206ebac
commit b9394f2ba2
24 changed files with 1713 additions and 156 deletions

View file

@ -45,6 +45,11 @@
#ifdef Q_WS_WIN
#include <shlobj.h>
#include <windows.h>
const int UNLEN = 256;
#else
#include <unistd.h>
#include <sys/types.h>
#endif
#ifdef Q_WS_MAC
@ -545,6 +550,19 @@ QString misc::userFriendlyDuration(qlonglong seconds) {
return QString::fromUtf8("");
}
QString misc::getUserIDString() {
QString uid = "0";
#ifdef Q_WS_WIN
char buffer[UNLEN+1] = {0};
DWORD buffer_len = UNLEN + 1;
if (!GetUserNameA(buffer, &buffer_len))
uid = QString(buffer);
#else
uid = QString::number(getuid());
#endif
return uid;
}
QStringList misc::toStringList(const QList<bool> &l) {
QStringList ret;
foreach(const bool &b, l) {