+ return rc;
+ }
+ write_length= check_length;
+ }
+ else
+ {
+ char *buffer_ptr= buffer;
+ const char *command= storage_op_string(verb);
+
+ /* Copy in the command, no space needed, we handle that in the command function*/
+ memcpy(buffer_ptr, command, strlen(command));
+
+ /* Copy in the key prefix, switch to the buffer_ptr */
+ buffer_ptr= memcpy((buffer_ptr + strlen(command)), memcached_array_string(ptr->prefix_key), memcached_array_size(ptr->prefix_key));
+
+ /* Copy in the key, adjust point if a key prefix was used. */
+ buffer_ptr= memcpy(buffer_ptr + memcached_array_size(ptr->prefix_key),
+ key, key_length);
+ buffer_ptr+= key_length;
+ buffer_ptr[0]= ' ';
+ buffer_ptr++;
+
+ write_length= (size_t)(buffer_ptr - buffer);
+ int check_length;
+ check_length= snprintf(buffer_ptr, MEMCACHED_DEFAULT_COMMAND_SIZE -(size_t)(buffer_ptr - buffer),
+ "%u %llu %lu%s\r\n",
+ flags,
+ (unsigned long long)expiration, (unsigned long)value_length,
+ ptr->flags.no_reply ? " noreply" : "");
+ if ((size_t)check_length >= MEMCACHED_DEFAULT_COMMAND_SIZE -(size_t)(buffer_ptr - buffer) || check_length < 0)
+ {
+ rc= MEMCACHED_WRITE_FAILURE;
+ memcached_io_reset(instance);