diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2014-10-27 12:48:52 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2014-10-27 12:48:52 +0100 |
commit | 1eaf24b12168a28bc251821d205b6b67fba08012 (patch) | |
tree | 659a42ec21e8a3865566c5640e2958a7c6122a81 /src | |
parent | 0c2819dafa67d5989ffb82283c36e1916db732b7 (diff) | |
parent | 7a6da7878566dc18acb540bd29f7e11fa7e3ff66 (diff) | |
download | qtserialport-1eaf24b12168a28bc251821d205b6b67fba08012.tar.gz |
Merge remote-tracking branch 'origin/5.4' into dev
Change-Id: I761f9e1f101e65526c4651c5f5556363789f7db7
Diffstat (limited to 'src')
-rw-r--r-- | src/serialport/qserialport_unix.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/serialport/qserialport_unix.cpp b/src/serialport/qserialport_unix.cpp index 9979256..eb71e86 100644 --- a/src/serialport/qserialport_unix.cpp +++ b/src/serialport/qserialport_unix.cpp @@ -72,13 +72,21 @@ QString serialPortLockFilePath(const QString &portName) #endif ; + QString fileName = portName; + fileName.replace(QLatin1Char('/'), QLatin1Char('_')); + fileName.prepend(QStringLiteral("/LCK..")); + QString lockFilePath; foreach (const QString &lockDirectoryPath, lockDirectoryPaths) { + const QString filePath = lockDirectoryPath + fileName; + QFileInfo lockDirectoryInfo(lockDirectoryPath); - if (lockDirectoryInfo.isReadable() && lockDirectoryInfo.isWritable()) { - lockFilePath = lockDirectoryPath; - break; + if (lockDirectoryInfo.isReadable()) { + if (QFile::exists(filePath) || lockDirectoryInfo.isWritable()) { + lockFilePath = filePath; + break; + } } } @@ -89,11 +97,6 @@ QString serialPortLockFilePath(const QString &portName) return QString(); } - QString replacedPortName = portName; - - lockFilePath.append(QStringLiteral("/LCK..")); - lockFilePath.append(replacedPortName.replace(QLatin1Char('/'), QLatin1Char('_'))); - return lockFilePath; } |