X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=lib%2Fmemcached_stats.c;h=867147591c195116773d2a62ce752232846d0919;hb=557de9b08007dd2b482778ba934574bcf7ee531f;hp=8a05dfd93a30d12c0d8d409906ac2b08c904b73e;hpb=1c5dea03fd77a12341688b41e8b63e1c358a2ad6;p=m6w6%2Flibmemcached diff --git a/lib/memcached_stats.c b/lib/memcached_stats.c index 8a05dfd9..86714759 100644 --- a/lib/memcached_stats.c +++ b/lib/memcached_stats.c @@ -139,15 +139,20 @@ static memcached_return memcached_stats_fetch(memcached_st *ptr, if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE) return MEMCACHED_WRITE_FAILURE; - if ((sent_length= write(ptr->hosts[server_key].fd, buffer, send_length) == -1)) - { - fprintf(stderr, "failed on stats\n"); + sent_length= write(ptr->hosts[server_key].fd, buffer, send_length); + if (sent_length == -1) + { + fprintf(stderr, "error %s: write: %m\n", __FUNCTION__); return MEMCACHED_WRITE_FAILURE; } + if (sent_length != send_length) + { + fprintf(stderr, "error %s: short write %d %d: %m\n", + __FUNCTION__, sent_length, send_length); return MEMCACHED_WRITE_FAILURE; - + } rc= memcached_response(ptr, buffer, HUGE_STRING_LEN, 0);