diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-06-24 19:57:58 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-06-24 19:57:58 +0000 |
commit | 2d1994c949088978de5a6d064afaf2bdb4168e2d (patch) | |
tree | e601d8177fbba63c677459b445ffdf7aafd1358c /cpukit/libfs/src/pipe | |
parent | 2010-06-24 Bharath Suri <bharath.s.jois@gmail.com> (diff) | |
download | rtems-2d1994c949088978de5a6d064afaf2bdb4168e2d.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/src/pipe')
-rw-r--r-- | cpukit/libfs/src/pipe/fifo.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cpukit/libfs/src/pipe/fifo.c b/cpukit/libfs/src/pipe/fifo.c index d306c00395..38b90ed36e 100644 --- a/cpukit/libfs/src/pipe/fifo.c +++ b/cpukit/libfs/src/pipe/fifo.c @@ -104,6 +104,8 @@ 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, @@ -342,15 +344,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; |