Decode file-name to pass as QString to QFile::exists()

QSharedMemorySystemV::updateNativeKeyFile() stores the QBA
nativeKeyFile member using QFile::encodeName(), so feed it back
through QFile::decodeName() rather than relying on QString(QByteArray)
coercion, which might use a different encoding.
Fixes a CodeChecker grumble.

Change-Id: If9fb01ed65b5bba8c1070b4939ee1d87adf94743
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Edward Welbourne 2023-01-23 12:06:03 +01:00
parent 7d45117571
commit 1cd7bdeceb

View File

@ -72,7 +72,7 @@ key_t QSharedMemorySystemV::handle(QSharedMemoryPrivate *self)
}
// ftok requires that an actual file exists somewhere
if (!QFile::exists(nativeKeyFile)) {
if (!QFile::exists(QFile::decodeName(nativeKeyFile))) {
self->setError(QSharedMemory::NotFound,
QSharedMemory::tr("%1: UNIX key file doesn't exist")
.arg("QSharedMemory::handle:"_L1));