summaryrefslogtreecommitdiffstats
path: root/cpukit/libfs
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2010-06-24 19:58:00 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2010-06-24 19:58:00 +0000
commitf33be44e4ab913504ea000564848a41a6b74e6ca (patch)
treeabd3ce0a9c331ace668307dcb4712b834368cf9b /cpukit/libfs
parent2010-06-24 Joel Sherrill <joel.sherrilL@OARcorp.com> (diff)
downloadrtems-f33be44e4ab913504ea000564848a41a6b74e6ca.tar.bz2
2010-06-24 Bharath Suri <bharath.s.jois@gmail.com>
PR 1542/filesystem PR 1585/filesystem * libfs/src/pipe/fifo.c: pipe_control_t was not deallocated if fifo_open() was attempted with (O_WRONLY|O_NONBLOCK). Mutex was locked too many times on this path and we needed an unlock.
Diffstat (limited to 'cpukit/libfs')
-rw-r--r--cpukit/libfs/src/pipe/fifo.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/cpukit/libfs/src/pipe/fifo.c b/cpukit/libfs/src/pipe/fifo.c
index 694b69ab4f..5ec5a3050f 100644
--- a/cpukit/libfs/src/pipe/fifo.c
+++ b/cpukit/libfs/src/pipe/fifo.c
@@ -102,6 +102,7 @@ static int pipe_alloc(
if (! pipe->Buffer)
goto err_buf;
+ err = -ENOMEM;
if (rtems_barrier_create(
rtems_build_name ('P', 'I', 'r', c),
RTEMS_BARRIER_MANUAL_RELEASE, 0,
@@ -301,15 +302,17 @@ int fifo_open(
break;
case LIBIO_FLAGS_WRITE:
+ pipe->writerCounter ++;
+
+ if (pipe->Writers ++ == 0)
+ PIPE_WAKEUPREADERS(pipe);
+
if (pipe->Readers == 0 && LIBIO_NODELAY(iop)) {
+ PIPE_UNLOCK(pipe);
err = -ENXIO;
goto out_error;
}
- pipe->writerCounter ++;
- if (pipe->Writers ++ == 0)
- PIPE_WAKEUPREADERS(pipe);
-
if (pipe->Readers == 0) {
prevCounter = pipe->readerCounter;
err = -EINTR;