Fix all include location, and drop versions of the library that were never shipped.
[awesomized/libmemcached] / clients / memcp.cc
index 59bd7478bb780a89d447d9c8949b1381c7342baa..4ad0919d008a540d763cea73718c71762aa1a7fe 100644 (file)
@@ -1,4 +1,5 @@
 /* LibMemcached
+ * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
  * Copyright (C) 2006-2009 Brian Aker
  * All rights reserved.
  *
@@ -30,7 +31,7 @@
 #include <unistd.h>
 
 
-#include <libmemcached/memcached.h>
+#include <libmemcached-1.0/memcached.h>
 
 #include "client_options.h"
 #include "utilities.h"
@@ -207,6 +208,7 @@ int main(int argc, char *argv[])
     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);
     }
 
@@ -214,12 +216,14 @@ int main(int argc, char *argv[])
     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);
     }