Standardize the snprintf() failure messages, and add tests for libmemcached_util_getpid()
[awesomized/libmemcached] / libmemcached / flush.cc
index 6a1364c27c31d6e12bc12d1690017e2e9c7d80fe..5895f030fa5d7e4133c7bc2f33bee49e4426d28b 100644 (file)
@@ -88,7 +88,8 @@ static memcached_return_t memcached_flush_textual(memcached_st *ptr,
 
     if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE || send_length < 0)
     {
-      return MEMCACHED_FAILURE;
+      return memcached_set_error(*instance, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT, 
+                                 memcached_literal_param("snprintf(MEMCACHED_DEFAULT_COMMAND_SIZE)"));
     }
 
     rc= memcached_do(instance, buffer, (size_t)send_length, true);