Ticket #1542: pr1542,diff

File pr1542,diff, 1.0 KB (added by Joel Sherrill, on 06/24/10 at 18:52:00)

Patch from 1546 and also addresses 1585

Line 
1Index: cpukit/libfs/src/pipe/fifo.c
2===================================================================
3RCS file: /usr1/CVS/rtems/cpukit/libfs/src/pipe/fifo.c,v
4retrieving revision 1.8
5diff -u -r1.8 fifo.c
6--- cpukit/libfs/src/pipe/fifo.c        23 Jun 2010 05:01:46 -0000      1.8
7+++ cpukit/libfs/src/pipe/fifo.c        24 Jun 2010 19:51:10 -0000
8@@ -104,6 +104,8 @@
9   if (! pipe->Buffer)
10     goto err_buf;
11 
12+  err = -ENOMEM;
13+
14   if (rtems_barrier_create(
15         rtems_build_name ('P', 'I', 'r', c),
16         RTEMS_BARRIER_MANUAL_RELEASE, 0,
17@@ -342,15 +344,17 @@
18       break;
19 
20     case LIBIO_FLAGS_WRITE:
21+      pipe->writerCounter ++;
22+
23+      if (pipe->Writers ++ == 0)
24+        PIPE_WAKEUPREADERS(pipe);
25+
26       if (pipe->Readers == 0 && LIBIO_NODELAY(iop)) {
27+       PIPE_UNLOCK(pipe);
28         err = -ENXIO;
29         goto out_error;
30       }
31 
32-      pipe->writerCounter ++;
33-      if (pipe->Writers ++ == 0)
34-        PIPE_WAKEUPREADERS(pipe);
35-
36       if (pipe->Readers == 0) {
37         prevCounter = pipe->readerCounter;
38         err = -EINTR;