hrev54898 adds 1 changeset to branch 'master'
old head: 7e677f6465564e712cd43b29b830e917708fd734
new head: bddb122eb4b4023e3f7dfceef513cf4ef002582e
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=bddb122eb4b4+%5E7e677f646556
----------------------------------------------------------------------------
bddb122eb4b4: kernel/xsi_msg: if MessageQueueID() is -1, the message queue
doesn't exist
fix #16757
Change-Id: I7c381e18c468b8c209fb275ef5e899c49aa26ffd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3643
Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxx>
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>
[ Jérôme Duval <jerome.duval@xxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev54898
Commit: bddb122eb4b4023e3f7dfceef513cf4ef002582e
URL: https://git.haiku-os.org/haiku/commit/?id=bddb122eb4b4
Author: Jérôme Duval <jerome.duval@xxxxxxxxx>
Date: Mon Jan 18 19:54:47 2021 UTC
Ticket: https://dev.haiku-os.org/ticket/16757
----------------------------------------------------------------------------
1 file changed, 8 insertions(+), 6 deletions(-)
src/system/kernel/posix/xsi_message_queue.cpp | 14 ++++++++------
----------------------------------------------------------------------------
diff --git a/src/system/kernel/posix/xsi_message_queue.cpp
b/src/system/kernel/posix/xsi_message_queue.cpp
index b2807ab156..4037d38a1a 100644
--- a/src/system/kernel/posix/xsi_message_queue.cpp
+++ b/src/system/kernel/posix/xsi_message_queue.cpp
@@ -660,19 +660,21 @@ _user_xsi_msgget(key_t key, int flags)
// Check if key already exist, if it does it already has a
message
// queue associated with it
ipcKey = sIpcHashTable.Lookup(key);
- if (ipcKey == NULL) {
+ if (ipcKey == NULL || ipcKey->MessageQueueID() == -1) {
if (!(flags & IPC_CREAT)) {
TRACE_ERROR(("xsi_msgget: key %d does not
exist, but the "
"caller did not ask for creation\n",
(int)key));
return ENOENT;
}
- ipcKey = new(std::nothrow) Ipc(key);
if (ipcKey == NULL) {
- TRACE_ERROR(("xsi_msgget: failed to create new
Ipc object "
- "for key %d\n", (int)key));
- return ENOMEM;
+ ipcKey = new(std::nothrow) Ipc(key);
+ if (ipcKey == NULL) {
+ TRACE_ERROR(("xsi_msgget: failed to
create new Ipc object "
+ "for key %d\n", (int)key));
+ return ENOMEM;
+ }
+ sIpcHashTable.Insert(ipcKey);
}
- sIpcHashTable.Insert(ipcKey);
} else {
// The IPC key exist and it already has a message queue
if ((flags & IPC_CREAT) && (flags & IPC_EXCL)) {