X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=lib%2Fmemcached_stats.c;h=644ca70d41d24f722731cab263a73482f6c7202e;hb=735295f0989edbd884a2c3935d1219a59ebe5698;hp=ed2c0e20ffc2d4d7577ae57184eeb3b13e89f236;hpb=806525899ce3dff894b829416307a4290cd882e2;p=m6w6%2Flibmemcached diff --git a/lib/memcached_stats.c b/lib/memcached_stats.c index ed2c0e20..644ca70d 100644 --- a/lib/memcached_stats.c +++ b/lib/memcached_stats.c @@ -1,7 +1,7 @@ /* */ -#include +#include "common.h" static char *memcached_stat_keys[] = { "pid", @@ -240,7 +240,7 @@ static memcached_return memcached_stats_fetch(memcached_st *ptr, if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE) return MEMCACHED_WRITE_FAILURE; - sent_length= write(ptr->hosts[server_key].fd, buffer, send_length); + sent_length= memcached_io_write(ptr, server_key, buffer, send_length, 1); if (sent_length == -1 || sent_length != send_length) return MEMCACHED_WRITE_FAILURE; @@ -313,7 +313,7 @@ memcached_return memcached_stat_servername(memcached_stat_st *stat, char *args, memcached_return rc; memcached_st memc; - memcached_init(&memc); + memcached_create(&memc); memcached_server_add(&memc, hostname, port); @@ -324,7 +324,7 @@ memcached_return memcached_stat_servername(memcached_stat_st *stat, char *args, rc= memcached_stats_fetch(&memc, stat, args, 0); - memcached_deinit(&memc); + memcached_free(&memc); return rc; } @@ -338,6 +338,8 @@ char ** memcached_stat_get_keys(memcached_st *ptr, memcached_stat_st *stat, { char **list= (char **)malloc(sizeof(memcached_stat_keys)); + memset(list, 0, sizeof(memcached_stat_keys)); + if (!list) { *error= MEMCACHED_MEMORY_ALLOCATION_FAILURE;