diff options
Diffstat (limited to 'src/corelib/ipc/qsharedmemory_systemv.cpp')
-rw-r--r-- | src/corelib/ipc/qsharedmemory_systemv.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/ipc/qsharedmemory_systemv.cpp b/src/corelib/ipc/qsharedmemory_systemv.cpp index cc98b560ae..dc9de11091 100644 --- a/src/corelib/ipc/qsharedmemory_systemv.cpp +++ b/src/corelib/ipc/qsharedmemory_systemv.cpp @@ -11,6 +11,7 @@ #include <errno.h> +#if QT_CONFIG(sharedmemory) #if QT_CONFIG(sysv_shm) #include <sys/types.h> #include <sys/ipc.h> @@ -75,6 +76,7 @@ key_t QSharedMemorySystemV::handle(QSharedMemoryPrivate *self) unix_key = ftok(nativeKeyFile, int(self->nativeKey.type())); if (unix_key < 0) { self->setUnixErrorString("QSharedMemory::handle"_L1); + nativeKeyFile.clear(); unix_key = 0; } return unix_key; @@ -158,6 +160,8 @@ bool QSharedMemorySystemV::attach(QSharedMemoryPrivate *self, QSharedMemory::Acc int id = shmget(unix_key, 0, (mode == QSharedMemory::ReadOnly ? 0400 : 0600)); if (-1 == id) { self->setUnixErrorString("QSharedMemory::attach (shmget)"_L1); + unix_key = 0; + nativeKeyFile.clear(); return false; } @@ -205,3 +209,4 @@ bool QSharedMemorySystemV::detach(QSharedMemoryPrivate *self) QT_END_NAMESPACE #endif // QT_CONFIG(sysv_shm) +#endif // QT_CONFIG(sharedmemory) |