need malloc.h" logic a bit more. (Trying to prevent #warning and
#error problems on *BSD systems.)
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#else
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
+
+#if defined(HAVE_MALLOC_H) && (defined(HAVE_MALLINFO) || !defined(HAVE_STDLIB_H))
+#include <malloc.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#endif
#ifdef HAVE_SYS_SOCKET_H
-#ifdef HAVE_MALLOC_H
-# include <malloc.h>
-#endif
-
/* these are needed for the uid/gid mapping code */
#include <pwd.h>
#include <grp.h>
/* these are needed for the uid/gid mapping code */
#include <pwd.h>
#include <grp.h>