diff --git a/src/corelib/ipc/qsharedmemory_systemv.cpp b/src/corelib/ipc/qsharedmemory_systemv.cpp index ddf9a36cd67..dc9de11091d 100644 --- a/src/corelib/ipc/qsharedmemory_systemv.cpp +++ b/src/corelib/ipc/qsharedmemory_systemv.cpp @@ -160,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; } diff --git a/tests/auto/corelib/ipc/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/corelib/ipc/qsharedmemory/tst_qsharedmemory.cpp index 8e7d0064ce7..faa56482b34 100644 --- a/tests/auto/corelib/ipc/qsharedmemory/tst_qsharedmemory.cpp +++ b/tests/auto/corelib/ipc/qsharedmemory/tst_qsharedmemory.cpp @@ -575,9 +575,6 @@ void tst_QSharedMemory::attachBeforeCreate() const qsizetype sz = 100; QSharedMemory mem(key); QVERIFY(!mem.attach()); - // Fails for all SystemV backends now - if (!legacy && (keyType < QNativeIpcKey::Type::PosixRealtime)) - QEXPECT_FAIL("", "Not fixed yet", Continue); QVERIFY(mem.create(sz)); }