[Olsr-dev] [PATCH v1 1/1] quagga: restore socket status on error paths in zclient_read function

Ferry Huberts (spam-protected)
Sat Oct 17 22:42:52 CEST 2015


From: Ferry Huberts <(spam-protected)>

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 lib/quagga/src/client.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/quagga/src/client.c b/lib/quagga/src/client.c
index 9d25ff8..922db9d 100644
--- a/lib/quagga/src/client.c
+++ b/lib/quagga/src/client.c
@@ -177,6 +177,9 @@ zclient_read(ssize_t * size)
     bytes = read(zebra.sock, buf + *size, bufsize - *size);
     /* handle broken packet */
     if (!bytes) {
+      /* restore socket status */
+      (void)fcntl(zebra.sock, F_SETFL, sockstatus);
+
       free(buf);
       return NULL;
     }
@@ -188,6 +191,10 @@ zclient_read(ssize_t * size)
         zebra.status &= ~STATUS_CONNECTED;
         /* TODO: Remove HNAs added from redistribution */
       }
+
+      /* restore socket status */
+      (void)fcntl(zebra.sock, F_SETFL, sockstatus);
+
       free(buf);
       return NULL;
     }
-- 
2.4.3




More information about the Olsr-dev mailing list