[or-cvs] fix another underflow in keeping stats

arma at seul.org arma at seul.org
Thu Jun 9 03:57:56 UTC 2005


Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or

Modified Files:
	buffers.c 
Log Message:
fix another underflow in keeping stats
these size_ts are subtle buggers


Index: buffers.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/buffers.c,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -d -r1.156 -r1.157
--- buffers.c	8 Jun 2005 21:55:02 -0000	1.156
+++ buffers.c	9 Jun 2005 03:57:54 -0000	1.157
@@ -188,7 +188,8 @@
     SET_GUARDS(buf->mem, new_capacity);
     buf->cur = buf->mem+offset;
   }
-  buf_total_alloc += (new_capacity - buf->len);
+  buf_total_alloc += new_capacity;
+  buf_total_alloc -= buf->len;
 
   if (offset + buf->datalen > buf->len) {
     /* We need to move data now that we are done growing.  The buffer
@@ -673,7 +674,8 @@
   }
   if (buf->datalen > buf->highwater)
     buf->highwater = buf->datalen;
-  log_fn(LOG_DEBUG,"added %d bytes to buf (now %d total).",(int)string_len, (int)buf->datalen);
+  log_fn(LOG_DEBUG,"added %d bytes to buf (now %d total).",
+         (int)string_len, (int)buf->datalen);
   check();
   return buf->datalen;
 }



More information about the tor-commits mailing list