Index: libmemcached-0.35/libmemcached/memcached.h
--- libmemcached-0.35/libmemcached/memcached.h.orig	2009-07-10 18:05:27 +0200
+++ libmemcached-0.35/libmemcached/memcached.h	2009-07-11 08:29:27 +0200
@@ -10,6 +10,7 @@
 #ifndef __MEMCACHED_H__
 #define __MEMCACHED_H__
 
+#include <sys/types.h>
 #include <stdlib.h>
 #include <inttypes.h>
 #if !defined(__cplusplus)
Index: memcached-1.4.0/memcached.h
--- memcached-1.4.0/memcached.h.orig	2009-07-09 19:16:24 +0200
+++ memcached-1.4.0/memcached.h	2009-07-11 08:29:27 +0200
@@ -12,6 +12,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/time.h>
+#include <sys/socket.h>
 #include <netinet/in.h>
 #include <event.h>
 #include <netdb.h>
Index: memcached-1.4.0/thread.c
--- memcached-1.4.0/thread.c.orig	2009-07-09 19:16:24 +0200
+++ memcached-1.4.0/thread.c	2009-07-11 08:29:27 +0200
@@ -598,6 +598,7 @@
         perror("Can't allocate thread descriptors");
         exit(1);
     }
+    memset(threads, 0, sizeof(LIBEVENT_THREAD) * nthreads);
 
     threads[0].base = main_base;
     threads[0].thread_id = pthread_self();
