summaryrefslogtreecommitdiffstats
path: root/src/corelib/ipc/qsystemsemaphore_systemv.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/ipc/qsystemsemaphore_systemv.cpp')
-rw-r--r--src/corelib/ipc/qsystemsemaphore_systemv.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/ipc/qsystemsemaphore_systemv.cpp b/src/corelib/ipc/qsystemsemaphore_systemv.cpp
index cdfa6adfd4..e5d231d1d4 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) {
@@ -174,7 +174,7 @@ bool QSystemSemaphoreSystemV::modifySemaphore(QSystemSemaphorePrivate *self, int
operation.sem_flg = SEM_UNDO;
int res;
- EINTR_LOOP(res, semop(semaphore, &operation, 1));
+ QT_EINTR_LOOP(res, semop(semaphore, &operation, 1));
if (-1 == res) {
// If the semaphore was removed be nice and create it and then modifySemaphore again
if (errno == EINVAL || errno == EIDRM) {