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_delete.c
diff --git
a/lib/memcached_delete.c
b/lib/memcached_delete.c
index 11b22ece6bbbd7957447f9c9fb3343742bd3e89f..75087bd491b3c65a397ed798427fc920ae5c052b 100644
(file)
--- a/
lib/memcached_delete.c
+++ b/
lib/memcached_delete.c
@@
-26,10
+26,20
@@
memcached_return memcached_delete(memcached_st *ptr, char *key, size_t key_lengt
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))
+ 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;
+ }
return memcached_response(ptr, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, server_key);
}
return memcached_response(ptr, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, server_key);
}