offset);
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;
+ }
if (sent_length != send_length)
+ {
+ fprintf(stderr, "error %s: short write %d %d: %m\n",
+ __FUNCTION__, sent_length, send_length);
return MEMCACHED_WRITE_FAILURE;
+ }
memset(buffer, 0, MEMCACHED_DEFAULT_COMMAND_SIZE);
send_length= read(ptr->hosts[server_key].fd, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE);
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;
+ }
+
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_response(ptr, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, server_key);
}
if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
return MEMCACHED_WRITE_FAILURE;
- if ((sent_length= write(ptr->hosts[x].fd, buffer, send_length) == -1))
+ sent_length= write(ptr->hosts[x].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, MEMCACHED_DEFAULT_COMMAND_SIZE, x);
(int)key_length, key);
if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
- return MEMCACHED_WRITE_FAILURE;
+ {
+ *error= MEMCACHED_WRITE_FAILURE;
+ return NULL;
+ }
- 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__);
*error= MEMCACHED_WRITE_FAILURE;
return NULL;
}
- 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);
*error= MEMCACHED_WRITE_FAILURE;
return NULL;
}
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);
{
memcached_return rc;
- if ((sent_length= write(ptr->hosts[x].fd, buffer, send_length) == -1))
+ sent_length= write(ptr->hosts[x].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, MEMCACHED_DEFAULT_COMMAND_SIZE, x);
rc = memcached_flush(memc, opt_expire);\r
if (rc != MEMCACHED_SUCCESS) \r
{\r
- fprintf(stderr, "memflush: %s: memcache error %s\n", \r
- argv[optind], memcached_strerror(memc, rc));\r
+ fprintf(stderr, "memflush: memcache error %s\n", \r
+ memcached_strerror(memc, rc));\r
}\r
\r
memcached_deinit(memc);\r