diff options
Diffstat (limited to 'cpukit/posix/src/mqueuecreatesupp.c')
-rw-r--r-- | cpukit/posix/src/mqueuecreatesupp.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/cpukit/posix/src/mqueuecreatesupp.c b/cpukit/posix/src/mqueuecreatesupp.c index 335d1fc74d..90bab33ed7 100644 --- a/cpukit/posix/src/mqueuecreatesupp.c +++ b/cpukit/posix/src/mqueuecreatesupp.c @@ -11,7 +11,7 @@ * This code ignores the O_RDONLY/O_WRONLY/O_RDWR flag at open * time. * - * COPYRIGHT (c) 1989-2007. + * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -67,8 +67,7 @@ int _POSIX_Message_queue_Create_support( size_t n; n = strnlen( name_arg, NAME_MAX ); - if ( n > NAME_MAX ) - return ENAMETOOLONG; + /* length of name has already been validated */ _Thread_Disable_dispatch(); @@ -78,7 +77,6 @@ int _POSIX_Message_queue_Create_support( * compatibility. See README.mqueue for an example program we * think will print out the defaults. Report anything you find with it. */ - if ( attr_ptr == NULL ) { attr.mq_maxmsg = 10; attr.mq_msgsize = 16; @@ -111,25 +109,25 @@ int _POSIX_Message_queue_Create_support( * Make a copy of the user's string for name just in case it was * dynamically constructed. */ - - name = _Workspace_Allocate(n); + name = _Workspace_Allocate(n+1); if (!name) { _POSIX_Message_queue_Free( the_mq ); _Thread_Enable_dispatch(); rtems_set_errno_and_return_minus_one( ENOMEM ); } - strcpy( name, name_arg ); + strncpy( name, name_arg, n+1 ); - /* XXX - * - * Note that thread blocking discipline should be based on the + /* + * NOTE: That thread blocking discipline should be based on the * current scheduling policy. + * + * Joel: Cite POSIX or OpenGroup on above statement so we can determine + * if it is a real requirement. */ - the_mq_attr = &the_mq->Message_queue.Attributes; the_mq_attr->discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO; - if ( ! _CORE_message_queue_Initialize( + if ( !_CORE_message_queue_Initialize( &the_mq->Message_queue, the_mq_attr, attr.mq_maxmsg, |