Ignore:
Timestamp:
12/23/99 22:09:36 (23 years ago)
Author:
Jennifer Averett <Jennifer.Averett@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
afebb3f
Parents:
8f12d069
Message:

+ Debugged.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/posix/src/mqueueopen.c

    r8f12d069 r7fbef786  
    4848  Objects_Id                     the_mq_id;
    4949  POSIX_Message_queue_Control   *the_mq;
     50  Objects_Locations              location;
    5051 
     52  _Thread_Disable_dispatch();
     53
    5154  if ( oflag & O_CREAT ) {
    5255    va_start(arg, oflag);
     
    6770  if ( status ) {
    6871 
    69     if ( status == EINVAL ) {      /* name -> ID translation failed */
    70       if ( !(oflag & O_CREAT) ) {  /* willing to create it? */
    71         set_errno_and_return_minus_one( ENOENT );
    72         return (mqd_t) -1;
    73       }
    74       /* we are willing to create it */
     72    /*
     73     * Unless provided a valid name that did not already exist
     74     * and we are willing to create then it is an error.
     75     */
     76
     77    if ( !( status == ENOENT && (oflag & O_CREAT) ) ) {
     78      _Thread_Enable_dispatch();
     79      set_errno_and_return_minus_one_cast( status, mqd_t );
    7580    }
    76     set_errno_and_return_minus_one( status ); /* some type of error */
    77     return (mqd_t) -1;
    78  
     81
    7982  } else {                /* name -> ID translation succeeded */
    8083 
     84    /*
     85     * Check for existence with creation.
     86     */
     87
    8188    if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) {
    82       set_errno_and_return_minus_one( EEXIST );
    83       return (mqd_t) -1;
     89      _Thread_Enable_dispatch();
     90      set_errno_and_return_minus_one_cast( EEXIST, mqd_t );
    8491    }
    85  
     92
    8693    /*
    8794     * XXX In this case we need to do an ID->pointer conversion to
    8895     *     check the mode.   This is probably a good place for a subroutine.
    8996     */
    90  
     97
     98    the_mq = _POSIX_Message_queue_Get( the_mq_id, &location );
    9199    the_mq->open_count += 1;
    92  
    93     return (mqd_t)&the_mq->Object.id;
     100    _Thread_Enable_dispatch();
     101    _Thread_Enable_dispatch();
     102    return (mqd_t)the_mq->Object.id;
    94103 
    95104  }
     
    109118  );
    110119 
     120  /*
     121   * errno was set by Create_support, so don't set it again.
     122   */
     123
     124  _Thread_Enable_dispatch();
     125
    111126  if ( status == -1 )
    112127    return (mqd_t) -1;
    113128 
    114   return (mqd_t) &the_mq->Object.id;
     129  return (mqd_t) the_mq->Object.id;
    115130}
    116131
Note: See TracChangeset for help on using the changeset viewer.