Move the brackets, otherwise the error handling code is never reached.
authorJohn Hay <jhay@meraka.org.za>
Mon, 31 Aug 2009 14:01:48 +0000 (16:01 +0200)
committerJohn Hay <jhay@meraka.org.za>
Mon, 31 Aug 2009 14:01:48 +0000 (16:01 +0200)
lib/dot_draw/src/olsrd_dot_draw.c

index 9212e81..3b09bb1 100644 (file)
@@ -300,17 +300,16 @@ dotdraw_write_data(void *foo __attribute__ ((unused))) {
 
   if (FD_ISSET(outbuffer_socket, &set)) {
     result = write(outbuffer_socket, outbuffer.buf, outbuffer.len);
-    if (result > 0) {
+    if (result > 0)
       abuf_pull(&outbuffer, result);
 
-      if (result <= 0) {
-        /* close this socket and cleanup*/
-        close(outbuffer_socket);
-        abuf_free(&outbuffer);
-        olsr_stop_timer(writetimer_entry);
-        writetimer_entry = NULL;
-        outbuffer_socket = -1;
-      }
+    if (result <= 0) {
+      /* close this socket and cleanup*/
+      close(outbuffer_socket);
+      abuf_free(&outbuffer);
+      olsr_stop_timer(writetimer_entry);
+      writetimer_entry = NULL;
+      outbuffer_socket = -1;
     }
   }
 }