openbsd-ports/misc/memcached/patches/patch-stats_c
jasper 4c60f3ab4b - update memcached to 1.4.0 ("many improvements have been made, upgrading is
recommended")

from Scott Vokes (MAINTAINER), thanks
2009-08-07 10:46:41 +00:00

27 lines
1.1 KiB
Plaintext

$OpenBSD: patch-stats_c,v 1.1 2009/08/07 10:46:41 jasper Exp $
--- stats.c.orig Sat Jul 11 11:03:25 2009
+++ stats.c Sat Jul 11 11:03:54 2009
@@ -322,16 +322,17 @@ static void test_prefix_dump() {
/* Find a key that hashes to the same bucket as "abc" */
for (keynum = 0; keynum < PREFIX_HASH_SIZE * 100; keynum++) {
- sprintf(tmp, "%d", keynum);
+ snprintf(tmp, 500, "%d", keynum);
if (hashval == hash(tmp, strlen(tmp), 0) % PREFIX_HASH_SIZE) {
break;
}
}
stats_prefix_record_set(tmp);
- sprintf(tmp, "PREFIX %d get 0 hit 0 set 1 del 0\r\n"
- "PREFIX abc get 2 hit 1 set 1 del 1\r\n"
- "PREFIX def get 0 hit 0 set 0 del 1\r\n"
- "END\r\n", keynum);
+ snprintf(tmp, 500,
+ "PREFIX %d get 0 hit 0 set 1 del 0\r\n"
+ "PREFIX abc get 2 hit 1 set 1 del 1\r\n"
+ "PREFIX def get 0 hit 0 set 0 del 1\r\n"
+ "END\r\n", keynum);
test_equals_str("stats with two stats in one bucket",
tmp, stats_prefix_dump(&length));
test_equals_int("stats length with two stats in one bucket",