]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #944: Fails to compile on openbsd etc.
authorhno <>
Tue, 21 Dec 2004 23:17:58 +0000 (23:17 +0000)
committerhno <>
Tue, 21 Dec 2004 23:17:58 +0000 (23:17 +0000)
There is several platforms where malloc.h SHOULD NOT be used even if
it exists, other platforms where it must be used..

In additions a few minor stupidities.

21 files changed:
include/MemPool.h
include/config.h
include/profiling.h
include/squid_endian.h
lib/Profiler.c
lib/hash.c
lib/radix.c
lib/util.c
snmplib/asn1.c
snmplib/coexistance.c
snmplib/mib.c
snmplib/parse.c
snmplib/snmp_api.c
snmplib/snmp_msg.c
snmplib/snmp_pdu.c
snmplib/snmp_vars.c
src/IPInterception.cc
src/cachemgr.cc
src/dnsserver.cc
src/main.cc
src/squid.h

index 628c89ba401162792cf664b6b5579382a9f768a3..a337d19b07a53d81d59df1d680a5fb1e9656bb8d 100644 (file)
@@ -10,7 +10,7 @@
 
 #if HAVE_GNUMALLOC_H
 #include <gnumalloc.h>
-#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_)
+#elif HAVE_MALLOC_H
 #include <malloc.h>
 #endif
 
index f1264cbb2685aad9de8b71228aeef4a295c44ff6..dc261b0aa65cd5065a5525059f3e7cbdde2a50af 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: config.h,v 1.13 2004/12/20 16:30:29 robertc Exp $
+ * $Id: config.h,v 1.14 2004/12/21 16:17:58 hno Exp $
  *
  * AUTHOR: Duane Wessels
  *
 #elif defined(__NetBSD__)
 #define _SQUID_NETBSD_
 
+#elif defined(__OpenBSD__)
+#define _SQUID_OPENBSD_
+
 #elif defined(__CYGWIN32__)  || defined(__CYGWIN__)
 #define _SQUID_CYGWIN_
 #define _SQUID_WIN32_
@@ -309,6 +312,13 @@ typedef union {
 #endif
 #endif
 
+/* 
+ * Don't allow inclusion of malloc.h on FreeBSD, Next and OpenBSD 
+ */
+#if defined(HAVE_MALLOC_H) && (defined(_SQUID_FREEBSD_) || defined(_SQUID_NEXT_) || defined(_SQUID_OPENBSD_))
+#undef HAVE_MALLOC_H
+#endif
+
 #if !defined(CACHEMGR_HOSTNAME)
 #define CACHEMGR_HOSTNAME ""
 #endif
index 221abbd02287a3893ecdf22ec4ce3a9de2220e96..6766cb22bd2732e5668cddc36006c4bfd2244cfe 100644 (file)
@@ -12,7 +12,7 @@ typedef int64_t  hrtime_t;
 #include <sys/time.h>
 #endif
 
-#if defined(__i386)
+#if defined(__i386) || defined(__i386__)
 static inline hrtime_t
 get_tick(void)
 {
index 862366ec246b4d5dbd074ab1e7b05ef15d536c87..05c46c3801fce0ff28f1bfd0a56934c144473f1a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: squid_endian.h,v 1.3 2003/08/16 23:32:29 robertc Exp $
+ * $Id: squid_endian.h,v 1.4 2004/12/21 16:17:58 hno Exp $
  *
  * AUTHOR: Alan Barrett
  *
  *
  * XXX: If htole16() is missing, we assume that the other *le*() functions
  *      are also missing.
+ *
+ *      Except OpenBSD - htole16 & 32 exist, but not le16toh etc
  */
+#if defined(_SQUID_OPENBSD_)
+#  define le16toh(x) htole16(x)
+#  define le32toh(x) htole32(x)
+#endif
+
 #if ! HAVE_HTOLE16 && ! defined(htole16)
 #  ifdef WORDS_BIGENDIAN
 #    define htole16(x) bswap16(x)
index 9ca7edb2d587a8dffebf0c5c9431cc746dce243b..38ad2aa8504acd1e220e0b6bbef1dfad7d33d393 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: Profiler.c,v 1.3 2003/02/03 21:33:14 robertc Exp $
+ * $Id: Profiler.c,v 1.4 2004/12/21 16:17:58 hno Exp $
  *
  * DEBUG: section 81     CPU Profiling Routines
  * AUTHOR: Andres Kroonmaa, Sep.2000
 
 #if HAVE_GNUMALLLOC_H
 #include <gnumalloc.h>
-#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_)
+#elif HAVE_MALLOC_H
 #include <malloc.h>
 #endif
 #if HAVE_UNISTD_H
index ee1fc5e92d0790c96c735e666c95a8013cc1753c..7fac464149fc003400d9a03bea52318f991fb90e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: hash.c,v 1.15 2003/01/23 00:37:01 robertc Exp $
+ * $Id: hash.c,v 1.16 2004/12/21 16:17:58 hno Exp $
  *
  * DEBUG: section 0     Hash Tables
  * AUTHOR: Harvest Derived
@@ -49,7 +49,7 @@
 #endif
 #if HAVE_GNUMALLLOC_H
 #include <gnumalloc.h>
-#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_)
+#elif HAVE_MALLOC_H
 #include <malloc.h>
 #endif
 #if HAVE_ASSERT_H
index 1f2c181b02d0a13e9d565f0bb3ecaf707aaa1827..fb5c4a77fe7361b7354a87f46998cbfeb3cbbc10 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: radix.c,v 1.20 2003/06/19 13:12:00 robertc Exp $
+ * $Id: radix.c,v 1.21 2004/12/21 16:17:58 hno Exp $
  *
  * DEBUG: section 53     Radix tree data structure implementation
  * AUTHOR: NetBSD Derived
@@ -96,7 +96,7 @@
 #endif
 #if HAVE_GNUMALLOC_H
 #include <gnumalloc.h>
-#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_)
+#elif HAVE_MALLOC_H
 #include <malloc.h>
 #endif
 #if HAVE_MEMORY_H
index 0c8467707c5ab29e6ef382e52e0088870f6fdf64..ce66f75929af59d1da69113f1e223e694dcab27c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: util.c,v 1.90 2003/03/02 22:20:31 hno Exp $
+ * $Id: util.c,v 1.91 2004/12/21 16:17:58 hno Exp $
  *
  * DEBUG: 
  * AUTHOR: Harvest Derived
@@ -55,7 +55,7 @@
 #endif
 #if HAVE_GNUMALLLOC_H
 #include <gnumalloc.h>
-#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_)
+#elif HAVE_MALLOC_H
 #include <malloc.h>
 #endif
 #if HAVE_ERRNO_H
index 47935c440a6bfb3df652413ac688349235db6114..bfdd3fda043a10bbf723dab04014be3c02a1cb42 100644 (file)
@@ -49,7 +49,7 @@
 #endif
 #if HAVE_GNUMALLOC_H
 #include <gnumalloc.h>
-#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_)
+#elif HAVE_MALLOC_H
 #include <malloc.h>
 #endif
 #if HAVE_MEMORY_H
index 029b1ab3529bd0130a2002d5c31ddc200145c160..e196f3e801ace62e626a474b69df8ab9d0e8d32e 100644 (file)
@@ -47,7 +47,7 @@
 #endif
 #if HAVE_GNUMALLOC_H
 #include <gnumalloc.h>
-#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_)
+#elif HAVE_MALLOC_H
 #include <malloc.h>
 #endif
 #if HAVE_MEMORY_H
index feef8efdfa4139d8b009a09cc271fe5d574413b3..20b169a27efa0709cb609d6e485df7bca674e45a 100644 (file)
@@ -39,7 +39,7 @@ SOFTWARE.
 #endif
 #if HAVE_GNUMALLOC_H
 #include <gnumalloc.h>
-#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_)
+#elif HAVE_MALLOC_H
 #include <malloc.h>
 #endif
 #if HAVE_MEMORY_H
index 9aae79dba374cd9715ce97cfcaafd94f8e09b173..537e61144dae5060dd0866228b5cc12345911926 100644 (file)
@@ -41,7 +41,7 @@ SOFTWARE.
 #endif
 #if HAVE_GNUMALLOC_H
 #include <gnumalloc.h>
-#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_)
+#elif HAVE_MALLOC_H
 #include <malloc.h>
 #endif
 #if HAVE_MEMORY_H
index 7b296178e886cf50f1d09b9ca6b3b53a5c4e2beb..345b53095df95d41c5cb469342f2e8016b358d06 100644 (file)
@@ -42,7 +42,7 @@
 #endif
 #if HAVE_GNUMALLOC_H
 #include <gnumalloc.h>
-#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_)
+#elif HAVE_MALLOC_H
 #include <malloc.h>
 #endif
 #if HAVE_MEMORY_H
index bec7625245d2f0797963e6e38e64eb1d6bb765df..9dea7b31b4d40da067c3ad42e0a4f2e2c9cf7913 100644 (file)
@@ -51,7 +51,7 @@
 #endif
 #if HAVE_GNUMALLOC_H
 #include <gnumalloc.h>
-#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_)
+#elif HAVE_MALLOC_H
 #include <malloc.h>
 #endif
 #if HAVE_MEMORY_H
index 6890ccc0c7481f5ac84a70b0a4452f68d8929ce9..6cea0a59e1bdbf245267f7eb81cbd83155c1934f 100644 (file)
@@ -51,7 +51,7 @@
 #endif
 #if HAVE_GNUMALLOC_H
 #include <gnumalloc.h>
-#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_)
+#elif HAVE_MALLOC_H
 #include <malloc.h>
 #endif
 #if HAVE_MEMORY_H
index 7e756a4162126e2fcd295335ccc9881d0f5ab351..d66edf1797cd8b4426a49ae4fac1858cca522766 100644 (file)
@@ -50,7 +50,7 @@
 #endif
 #if HAVE_GNUMALLOC_H
 #include <gnumalloc.h>
-#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_)
+#elif HAVE_MALLOC_H
 #include <malloc.h>
 #endif
 #if HAVE_MEMORY_H
index c1944f810eb26c64c36d9ab1d0e14f65d72a7744..034250a9d2cf92e5111a834fe05fc8923d6becea 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: IPInterception.cc,v 1.7 2003/08/03 08:09:26 robertc Exp $
+ * $Id: IPInterception.cc,v 1.8 2004/12/21 16:17:59 hno Exp $
  *
  * DEBUG: section 89    NAT / IP Interception 
  * AUTHOR: Robert Collins
@@ -211,7 +211,7 @@ clientNatLookup(int fd, struct sockaddr_in me, struct sockaddr_in peer, struct s
         return -1;
     } else
     {
-        int natted = me.sin_addr.s_addr != nt.rdaddr.v4.s_addr;
+        int natted = me.sin_addr.s_addr != nl.rdaddr.v4.s_addr;
         dst->sin_family = AF_INET;
         dst->sin_port = nl.rdport;
         dst->sin_addr = nl.rdaddr.v4;
index 87e12decf234f864cc4ce07af3b1a837e6525e5f..21e66b8950cd7e6b7c328d76b538fffa3d22d063 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cachemgr.cc,v 1.105 2003/08/11 13:07:56 robertc Exp $
+ * $Id: cachemgr.cc,v 1.106 2004/12/21 16:17:59 hno Exp $
  *
  * DEBUG: section 0     CGI Cache Manager
  * AUTHOR: Duane Wessels
@@ -61,7 +61,7 @@
 #endif
 #if HAVE_GNUMALLOC_H
 #include <gnumalloc.h>
-#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_)
+#elif HAVE_MALLOC_H
 #include <malloc.h>
 #endif
 #if HAVE_MEMORY_H
index 3fdf6c76336f46d1206f0f187cf4bdc59b968fd4..faeb8a5d36b99a4d37418fa0a513839eb41394cb 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: dnsserver.cc,v 1.67 2004/12/20 16:30:35 robertc Exp $
+ * $Id: dnsserver.cc,v 1.68 2004/12/21 16:17:59 hno Exp $
  *
  * DEBUG: section 0     DNS Resolver
  * AUTHOR: Harvest Derived
@@ -61,7 +61,7 @@
 #endif
 #if HAVE_GNUMALLOC_H
 #include <gnumalloc.h>
-#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_)
+#elif HAVE_MALLOC_H
 #include <malloc.h>
 #endif
 #if HAVE_MEMORY_H
index 0149c47d456503afff288675a1163693e49cc7dc..fdae0fc7f65e8d0486c52de430eae701d0e6b820 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: main.cc,v 1.396 2004/12/20 16:30:36 robertc Exp $
+ * $Id: main.cc,v 1.397 2004/12/21 16:18:00 hno Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -1261,8 +1261,8 @@ mainStartScript(const char *prog)
 
     if ((cpid = fork()) == 0) {
         /* child */
-        execl(script, squid_start_script, 0);
-        _exit(0);
+        execl(script, squid_start_script, NULL);
+        _exit(-1);
     } else {
         do {
 #ifdef _SQUID_NEXT_
index 37d3b81e1cb6a9877e996a24774a468c82c55786..b435be0135c7ce156b7196fdcaefae894e47e5ff 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: squid.h,v 1.241 2004/12/20 16:30:36 robertc Exp $
+ * $Id: squid.h,v 1.242 2004/12/21 16:18:00 hno Exp $
  *
  * AUTHOR: Duane Wessels
  *
@@ -74,7 +74,7 @@ extern void xassert(const char *, const char *, int);
 #endif
 #if HAVE_GNUMALLOC_H
 #include <gnumalloc.h>
-#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_)
+#elif HAVE_MALLOC_H
 #include <malloc.h>
 #endif
 #if HAVE_MEMORY_H