mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 15:15:44 +00:00
2009-01-29 Nickolay Semyonov-Kolchin <nbkolchin@gmail.com>
PR 1359/cpukit * libcsupport/src/libio.c: rtems_libio_allocate: rtems_libio_iop_freelist incorrectly zeroed on semaphore error. Now checks error and does not modify anything until sure it has created semaphore.
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
2009-01-29 Nickolay Semyonov-Kolchin <nbkolchin@gmail.com>
|
||||||
|
|
||||||
|
PR 1359/cpukit
|
||||||
|
* libcsupport/src/libio.c: rtems_libio_allocate:
|
||||||
|
rtems_libio_iop_freelist incorrectly zeroed on semaphore error. Now
|
||||||
|
checks error and does not modify anything until sure it has created
|
||||||
|
semaphore.
|
||||||
|
|
||||||
2009-01-29 Gene Smith <gene.smith@siemens.com>
|
2009-01-29 Gene Smith <gene.smith@siemens.com>
|
||||||
|
|
||||||
PR 1363/filesystem
|
PR 1363/filesystem
|
||||||
|
|||||||
@@ -149,23 +149,25 @@ rtems_libio_t *rtems_libio_allocate( void )
|
|||||||
{
|
{
|
||||||
rtems_libio_t *iop, *next;
|
rtems_libio_t *iop, *next;
|
||||||
rtems_status_code rc;
|
rtems_status_code rc;
|
||||||
|
rtems_id sema;
|
||||||
|
|
||||||
rtems_semaphore_obtain( rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT );
|
rtems_semaphore_obtain( rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT );
|
||||||
|
|
||||||
if (rtems_libio_iop_freelist) {
|
if (rtems_libio_iop_freelist) {
|
||||||
|
rc = rtems_semaphore_create(
|
||||||
|
RTEMS_LIBIO_IOP_SEM(rtems_libio_iop_freelist - rtems_libio_iops),
|
||||||
|
1,
|
||||||
|
RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
|
||||||
|
RTEMS_NO_PRIORITY,
|
||||||
|
&sema
|
||||||
|
);
|
||||||
|
if (rc != RTEMS_SUCCESSFUL)
|
||||||
|
goto failed;
|
||||||
iop = rtems_libio_iop_freelist;
|
iop = rtems_libio_iop_freelist;
|
||||||
next = iop->data1;
|
next = iop->data1;
|
||||||
(void) memset( iop, 0, sizeof(rtems_libio_t) );
|
(void) memset( iop, 0, sizeof(rtems_libio_t) );
|
||||||
iop->flags = LIBIO_FLAGS_OPEN;
|
iop->flags = LIBIO_FLAGS_OPEN;
|
||||||
rc = rtems_semaphore_create(
|
iop->sem = sema;
|
||||||
RTEMS_LIBIO_IOP_SEM(iop - rtems_libio_iops),
|
|
||||||
1,
|
|
||||||
RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
|
|
||||||
RTEMS_NO_PRIORITY,
|
|
||||||
&iop->sem
|
|
||||||
);
|
|
||||||
if (rc != RTEMS_SUCCESSFUL)
|
|
||||||
goto failed;
|
|
||||||
rtems_libio_iop_freelist = next;
|
rtems_libio_iop_freelist = next;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user