[Olsr-dev] [PATCH v1 079/115] info: write_data: use a safer 'close the socket' condition

Ferry Huberts (spam-protected)
Wed Dec 2 21:28:52 CET 2015


From: Ferry Huberts <(spam-protected)>

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 lib/info/olsrd_info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/info/olsrd_info.c b/lib/info/olsrd_info.c
index 23d3d31..516a0a6 100644
--- a/lib/info/olsrd_info.c
+++ b/lib/info/olsrd_info.c
@@ -191,7 +191,7 @@ static void write_data(void *foo __attribute__ ((unused))) {
         outbuffer.written[i] += result;
       }
 
-      if (result <= 0 || outbuffer.written[i] == outbuffer.size[i]) {
+      if ((result <= 0) || (outbuffer.written[i] >= outbuffer.size[i])) {
         /* close this socket and cleanup*/
         close(outbuffer.socket[i]);
         outbuffer.socket[i] = -1;
-- 
2.5.0




More information about the Olsr-dev mailing list