diff --git a/src/corelib/ipc/qsystemsemaphore_systemv.cpp b/src/corelib/ipc/qsystemsemaphore_systemv.cpp index cdfa6adfd4..e976fa5e09 100644 --- a/src/corelib/ipc/qsystemsemaphore_systemv.cpp +++ b/src/corelib/ipc/qsystemsemaphore_systemv.cpp @@ -53,6 +53,9 @@ bool QSystemSemaphoreSystemV::runtimeSupportCheck() */ key_t QSystemSemaphoreSystemV::handle(QSystemSemaphorePrivate *self, QSystemSemaphore::AccessMode mode) { + if (unix_key != -1) + return unix_key; // we already have a semaphore + #if defined(Q_OS_DARWIN) if (qt_apple_isSandboxed()) { // attempting to use System V semaphores will get us a SIGSYS @@ -73,9 +76,6 @@ key_t QSystemSemaphoreSystemV::handle(QSystemSemaphorePrivate *self, QSystemSema return -1; } - if (-1 != unix_key) - return unix_key; - // ftok requires that an actual file exists somewhere int built = QtIpcCommon::createUnixKeyFile(nativeKeyFile); if (-1 == built) {