r18593: try to get the same socket_wrapper file building in samba3 and samba4
[samba.git] / source4 / lib / socket_wrapper / socket_wrapper.c
index fe0b4dfe76b8a86dfb8a08a89e525a397441bcbd..5417f70a068b98d09937da968ed39bf12bfbac53 100644 (file)
 */
 
 #ifdef _SAMBA_BUILD_
+
+#define SOCKET_WRAPPER_NOT_REPLACE
 #include "includes.h"
-#undef SOCKET_WRAPPER
 #include "system/network.h"
 #include "system/filesys.h"
-#else
+
+#ifndef _DLINKLIST_H
+#include "lib/util/dlinklist.h"
+#endif
+
+#ifdef malloc
+#undef malloc
+#endif
+#ifdef calloc
+#undef calloc
+#endif
+#ifdef strdup
+#undef strdup
+#endif
+
+#else /* _SAMBA_BUILD_ */
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/socket.h>
 #include <unistd.h>
 #include <string.h>
 #include <stdio.h>
+
+#error "dlinklist.h missing"
+
 #endif
-#include "lib/util/dlinklist.h"
 
 /* LD_PRELOAD doesn't work yet, so REWRITE_CALLS is all we support
  * for now */