summaryrefslogtreecommitdiffstats
path: root/src/corelib/ipc/qtipccommon.cpp
diff options
context:
space:
mode:
authorJøger Hansegård <joger.hansegard@qt.io>2023-08-11 10:27:42 +0200
committerJøger Hansegård <joger.hansegard@qt.io>2023-08-12 01:28:49 +0200
commit73fd7f2d4a3b5c2441bb98268d30f8abfd604b14 (patch)
tree0927cd895c0c81fbfa465483d812a628bc034ed3 /src/corelib/ipc/qtipccommon.cpp
parent8a3330be38b5cac6098795f502fd54e7c8f555fb (diff)
Fix key truncation logic for Windows QSystemSemaphore::platformSafeKey
The QSystemSemaphore::platformSafeKey was intended to truncate oversized keys on Windows, but didn't. The fix is to make sure MAX_PATH is defined when compiling on Windows. Change-Id: I03f3bee901203d901bda05a841451c8a2d2f3924 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/ipc/qtipccommon.cpp')
-rw-r--r--src/corelib/ipc/qtipccommon.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/ipc/qtipccommon.cpp b/src/corelib/ipc/qtipccommon.cpp
index a2cc75b4b15..36d3bfc9a69 100644
--- a/src/corelib/ipc/qtipccommon.cpp
+++ b/src/corelib/ipc/qtipccommon.cpp
@@ -18,6 +18,8 @@
// by-one bug in the kernel) the usable bytes are only 30.
# define SHM_NAME_MAX 30
# endif
+#elif defined(Q_OS_WINDOWS)
+# include "qt_windows.h"
#endif
#if QT_CONFIG(sharedmemory) || QT_CONFIG(systemsemaphore)
@@ -194,7 +196,7 @@ QString QtIpcCommon::platformSafeKey(const QString &key, QtIpcCommon::IpcType ip
}
QString result = prefix + mid + payload;
-#ifdef MAX_PATH
+#ifdef Q_OS_WINDOWS
result.truncate(MAX_PATH);
#endif
return result;