syscalls/msgctl13: fix error on a rebooted system
The msqid is 0 when a new message queue is created by msgget() on a
freshly rebooted system. Then 'TEST(msgget(msg_q, MSG_RW))' succeed
unexpectedly since IPC_PRIVATE == 0.
Run 'msg_q = msgget(IPC_PRIVATE, MSG_RW)', we get:
msgget(IPC_PRIVATE, 0600) = 0
The msg_q is 0 when create it on the new system.Next:
msgctl(0, IPC_RMID, 0) = 0
msgget(IPC_PRIVATE, 0600) = 32768
The msg_q is equal to IPC_PRIVATE which is defined at kernel,
So msgget() will create a new message queue again and return
success unexpectedly.
Use msgctl with IPC_STAT to check that message queue was removed
instead.
Signed-off-by: Cui Bixuan <cuibixuan@huawei.com>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
1 file changed