#1570 closed defect (fixed)

sem_timedwait() returns error code instead of assigning errno and returning -1

Reported by: dufault Owned by: Joel Sherrill
Priority: normal Milestone: 4.11
Component: score Version: 4.10
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

Opengroup says:
"If the call was unsuccessful, the state of the semaphore shall be unchanged, and the function shall return a value of -1 and set errno to indicate the error".
The RTEMS implementation returns the error instead of doing that:

if ( !do_wait && (lock_status == EBUSY) ) {

switch (lock_status) {

case POSIX_ABSOLUTE_TIMEOUT_INVALID:

return EINVAL;

case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:

return ETIMEDOUT;

case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:

break;

}

}

Attachments (1)

semtimedwait.diff (674 bytes) - added by dufault on Jun 18, 2010 at 9:55:24 AM.
Set errno and return -1

Download all attachments as: .zip

Change History (2)

Changed on Jun 18, 2010 at 9:55:24 AM by dufault

Attachment: semtimedwait.diff added

Set errno and return -1

comment:1 Changed on Jun 21, 2010 at 3:39:34 PM by Joel Sherrill

Resolution: fixed
Status: newclosed

Patch with correction applied to head and all applicable branches.

Thanks.

Note: See TracTickets for help on using tickets.