]> code.delx.au - pulseaudio/commitdiff
Fix a nasty typo in pa_asyncq_pop
authorLennart Poettering <lennart@poettering.net>
Thu, 14 Jun 2007 20:11:46 +0000 (20:11 +0000)
committerLennart Poettering <lennart@poettering.net>
Thu, 14 Jun 2007 20:11:46 +0000 (20:11 +0000)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1480 fefdeb5f-60dc-0310-8127-8f9354f1896f

src/pulsecore/asyncq.c

index da1f16fb75bd1f9c0438051548981101418f1a36..c966e7dd04653633f7a3350accb2950805bfb444 100644 (file)
@@ -141,8 +141,10 @@ int pa_asyncq_push(pa_asyncq*l, void *p, int wait) {
                 int x[20];
                 
                 errno = 0;
-                if ((r = read(l->write_fds[0], x, sizeof(x))) <= 0 && errno != EINTR)
+                if ((r = read(l->write_fds[0], x, sizeof(x))) < 0 && errno != EINTR)
                     return -1;
+
+                pa_assert(r != 0);
                 
                 if (r > 0)
                     if (pa_atomic_sub(&l->n_read, r) <= r)
@@ -174,6 +176,8 @@ int pa_asyncq_push(pa_asyncq*l, void *p, int wait) {
                 return -1;
             }
 
+            pa_assert(r != 0);
+
             if (r > 0)
                 pa_atomic_sub(&l->n_read, r);
         }
@@ -220,8 +224,10 @@ void* pa_asyncq_pop(pa_asyncq*l, int wait) {
                 int x[20];
                 
                 errno = 0;
-                if ((r = read(l->read_fds[0], x, sizeof(x))) <= 0 && errno != EINTR)
+                if ((r = read(l->read_fds[0], x, sizeof(x))) < 0 && errno != EINTR)
                     return NULL;
+
+                pa_assert(r != 0);
                 
                 if (r > 0)
                     if (pa_atomic_sub(&l->n_written, r) <= r)
@@ -246,11 +252,13 @@ void* pa_asyncq_pop(pa_asyncq*l, int wait) {
 
             _Y;
 
-            if ((r = read(l->read_fds[0], x, sizeof(x)) < 0) && errno != EINTR) {
+            if ((r = read(l->read_fds[0], x, sizeof(x))) < 0 && errno != EINTR) {
                 pa_atomic_dec(&l->read_waiting);
                 return NULL;
             }
 
+            pa_assert(r != 0);
+
             if (r > 0)
                 pa_atomic_sub(&l->n_written, r);
         }
@@ -312,7 +320,4 @@ void pa_asyncq_after_poll(pa_asyncq *l) {
     pa_assert(pa_atomic_load(&l->read_waiting) > 0);
 
     pa_atomic_dec(&l->read_waiting);
-
-
-    
 }