/* LibMemcached
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
* Copyright (C) 2006-2009 Brian Aker
* All rights reserved.
*
*
*/
-#include "config.h"
+#include "mem_config.h"
#include <cerrno>
#include <climits>
#include <unistd.h>
-#include <libmemcached/memcached.h>
+#include <libmemcached-1.0/memcached.h>
#include "client_options.h"
#include "utilities.h"
if ((file_buffer_ptr= (char *)malloc(sizeof(char) * (size_t)sbuf.st_size)) == NULL)
{
std::cerr << "Error allocating file buffer(" << strerror(errno) << ")" << std::endl;
+ close(fd);
exit(EXIT_FAILURE);
}
if ((read_length= ::read(fd, file_buffer_ptr, (size_t)sbuf.st_size)) == -1)
{
std::cerr << "Error while reading file " << file_buffer_ptr << " (" << strerror(errno) << ")" << std::endl;
+ close(fd);
exit(EXIT_FAILURE);
}
if (read_length != sbuf.st_size)
{
std::cerr << "Failure while reading file. Read length was not equal to stat() length" << std::endl;
+ close(fd);
exit(EXIT_FAILURE);
}
if (memcached_failed(rc))
{
- std::cerr << "Error occrrured during operation: " << memcached_last_error_message(memc) << std::endl;
+ std::cerr << "Error occrrured during memcached_set(): " << memcached_last_error_message(memc) << std::endl;
+ ::close(fd);
exit_code= EXIT_FAILURE;
}
optind++;
}
+ if (opt_verbose)
+ {
+ std::cout << "Calling memcached_free()" << std::endl;
+ }
+
memcached_free(memc);
if (opt_servers)