From 5bc7c3724fbb06d934401400ac5922bcae2c6e95 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 23 Sep 2020 10:09:37 +0200 Subject: score: Improve _CORE_message_queue_Initialize() Return a status code and differentiate between error conditions. Update #4007. --- cpukit/posix/src/mqueueopen.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'cpukit/posix/src') diff --git a/cpukit/posix/src/mqueueopen.c b/cpukit/posix/src/mqueueopen.c index 35b8c923b1..af8abebea8 100644 --- a/cpukit/posix/src/mqueueopen.c +++ b/cpukit/posix/src/mqueueopen.c @@ -60,6 +60,7 @@ static mqd_t _POSIX_Message_queue_Create( { POSIX_Message_queue_Control *the_mq; char *name; + Status_Control status; /* length of name has already been validated */ @@ -97,14 +98,14 @@ static mqd_t _POSIX_Message_queue_Create( * Joel: Cite POSIX or OpenGroup on above statement so we can determine * if it is a real requirement. */ - if ( - !_CORE_message_queue_Initialize( - &the_mq->Message_queue, - CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO, - attr->mq_maxmsg, - attr->mq_msgsize - ) - ) { + status = _CORE_message_queue_Initialize( + &the_mq->Message_queue, + CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO, + attr->mq_maxmsg, + attr->mq_msgsize + ); + + if ( status != STATUS_SUCCESSFUL ) { _POSIX_Message_queue_Free( the_mq ); _Workspace_Free( name ); rtems_set_errno_and_return_value( ENOSPC, MQ_OPEN_FAILED ); -- cgit v1.2.3