projects
/
m6w6
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
emit messages to stderr when write fails
[m6w6/libmemcached]
/
lib
/
memcached_stats.c
diff --git
a/lib/memcached_stats.c
b/lib/memcached_stats.c
index 8a05dfd93a30d12c0d8d409906ac2b08c904b73e..867147591c195116773d2a62ce752232846d0919 100644
(file)
--- 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 (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;
}
return MEMCACHED_WRITE_FAILURE;
}
+
if (sent_length != send_length)
if (sent_length != send_length)
+ {
+ fprintf(stderr, "error %s: short write %d %d: %m\n",
+ __FUNCTION__, sent_length, send_length);
return MEMCACHED_WRITE_FAILURE;
return MEMCACHED_WRITE_FAILURE;
-
+ }
rc= memcached_response(ptr, buffer, HUGE_STRING_LEN, 0);
rc= memcached_response(ptr, buffer, HUGE_STRING_LEN, 0);