info: write_data: use a safer 'close the socket' condition
authorFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 2 Dec 2015 12:05:48 +0000 (13:05 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 2 Dec 2015 19:54:17 +0000 (20:54 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/info/olsrd_info.c

index 23d3d31..516a0a6 100644 (file)
@@ -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;