Fix an error handling bug in the fread logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5511 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
eb413a9145
commit
901912f4e5
@ -3907,4 +3907,7 @@
|
||||
that can be used for testing posix_spawn().
|
||||
* arch/arm/src/stm32: Bring F1 support for general DMA and serial
|
||||
DMA in paricular up to parity with F2/F4 (from Mike Smith).
|
||||
|
||||
* libc/stdio/lib_libfread.c: Correct some error handling when
|
||||
lib_fread() was passed a bad stream. Needed to move the
|
||||
releasing of a semaphore inside of some conditional logic
|
||||
(cosmetic).
|
||||
|
14
TODO
14
TODO
@ -1,4 +1,4 @@
|
||||
NuttX TODO List (Last updated January 10, 2013)
|
||||
NuttX TODO List (Last updated January 11, 2013)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This file summarizes known NuttX bugs, limitations, inconsistencies with
|
||||
@ -15,7 +15,7 @@ nuttx/
|
||||
(17) Network (net/, drivers/net)
|
||||
(4) USB (drivers/usbdev, drivers/usbhost)
|
||||
(12) Libraries (libc/, )
|
||||
(9) File system/Generic drivers (fs/, drivers/)
|
||||
(10) File system/Generic drivers (fs/, drivers/)
|
||||
(5) Graphics subystem (graphics/)
|
||||
(1) Pascal add-on (pcode/)
|
||||
(1) Documentation (Documentation/)
|
||||
@ -863,6 +863,16 @@ o File system / Generic drivers (fs/, drivers/)
|
||||
Status: Open
|
||||
Priority: Medium
|
||||
|
||||
Title: dup AND dup2 WILL NOT WORK ON FILES IN A MOUNTED VOLUME
|
||||
Description: The current implementation of dup() and dup2() will only
|
||||
work with open device drivers and sockets. It will not
|
||||
work with open files in a file system.
|
||||
|
||||
A limitation that results from this is that you cannot
|
||||
redirect I/O to an from and file.
|
||||
Status: Open
|
||||
Priority: High
|
||||
|
||||
o Graphics subystem (graphics/)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
@ -67,8 +67,8 @@
|
||||
|
||||
void lib_sem_initialize(FAR struct file_struct *stream)
|
||||
{
|
||||
/* Initialize the LIB semaphore to one (to support one-at-
|
||||
* a-time access to private data sets.
|
||||
/* Initialize the LIB semaphore to one (to support one-at-a-time access
|
||||
* to private data sets.
|
||||
*/
|
||||
|
||||
(void)sem_init(&stream->fs_sem, 0, 1);
|
||||
@ -98,13 +98,13 @@ void lib_take_semaphore(FAR struct file_struct *stream)
|
||||
/* Take the semaphore (perhaps waiting) */
|
||||
|
||||
while (sem_wait(&stream->fs_sem) != 0)
|
||||
{
|
||||
/* The only case that an error should occr here is if
|
||||
* the wait was awakened by a signal.
|
||||
*/
|
||||
{
|
||||
/* The only case that an error should occr here is if the wait
|
||||
* was awakened by a signal.
|
||||
*/
|
||||
|
||||
ASSERT(get_errno() == EINTR);
|
||||
}
|
||||
ASSERT(get_errno() == EINTR);
|
||||
}
|
||||
|
||||
/* We have it. Claim the stak and return */
|
||||
|
||||
|
@ -86,5 +86,3 @@ void stream_semgive(FAR struct streamlist *list)
|
||||
{
|
||||
sem_post(&list->sl_sem);
|
||||
}
|
||||
|
||||
|
||||
|
@ -301,9 +301,10 @@ ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE *stream)
|
||||
{
|
||||
stream->fs_flags |= __FS_FLAG_EOF;
|
||||
}
|
||||
|
||||
lib_give_semaphore(stream);
|
||||
}
|
||||
|
||||
lib_give_semaphore(stream);
|
||||
return bytes_read;
|
||||
|
||||
/* Error exits */
|
||||
|
Loading…
x
Reference in New Issue
Block a user