[esnacc-dev] [PATCH 3/7] exp-buf: Cleanup the read/write error flags

Aaron Conole aconole at bytheb.org
Tue Dec 20 17:14:10 UTC 2016


We want to signal errors in the various modes correctly.

Caught by code review.

Signed-off-by: Aaron Conole <aconole at bytheb.org>
---
 c-lib/src/exp-buf.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/c-lib/src/exp-buf.c b/c-lib/src/exp-buf.c
index a86a8c8..243fe79 100644
--- a/c-lib/src/exp-buf.c
+++ b/c-lib/src/exp-buf.c
@@ -510,12 +510,11 @@ ExpBufAllocBufAndData()
     if (retVal == NULL)
         return NULL;
 
-    retVal->readError = 0;
+    retVal->readError = 1;
     retVal->writeError = 0;
     retVal->blkStart = ExpBufAllocData();
 
-    if (retVal->blkStart == NULL)
-    {
+    if (retVal->blkStart == NULL) {
         ExpBufFreeBuf (retVal);
         return NULL;
     }
@@ -560,7 +559,7 @@ ExpBufInstallDataInBuf PARAMS ((buf, data, len),
     unsigned long len)
 {
     buf->readError = 0;
-    buf->writeError = 0;
+    buf->writeError = 1;
     buf->blkStart = buf->dataStart = buf->curr = data;
     buf->next = NULL;
     buf->prev = NULL;
-- 
2.7.4




More information about the dev mailing list