}
memcached_string_t _filename= { memcached_string_make_from_cstr(filename) };
- if (memcached_is_valid_servername(_filename) == false)
+ if (memcached_is_valid_filename(_filename) == false)
{
- memcached_set_error(*ptr, MEMCACHED_INVALID_ARGUMENTS, MEMCACHED_AT, memcached_literal_param("Invalid filename for socket provided"));
+ return memcached_set_error(*ptr, MEMCACHED_INVALID_ARGUMENTS, MEMCACHED_AT, memcached_literal_param("Invalid filename for socket provided"));
}
return server_add(ptr, _filename, 0, weight, MEMCACHED_CONNECTION_UNIX_SOCKET);
static inline bool memcached_is_valid_servername(const memcached_string_t& arg)
{
- return arg.size < NI_MAXHOST;
+ return (arg.c_str != NULL or arg.size == 0) and arg.size < NI_MAXHOST;
+}
+
+static inline bool memcached_is_valid_filename(const memcached_string_t& arg)
+{
+ return arg.c_str != NULL and arg.size > 0 and arg.size < NI_MAXHOST;
}
void memcached_instance_free(org::libmemcached::Instance *);