]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] move MAXPATHLEN definition to compat.h
authorWilly Tarreau <w@1wt.eu>
Sun, 7 Nov 2010 10:44:13 +0000 (11:44 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 11 Nov 2010 08:21:53 +0000 (09:21 +0100)
MAXPATHLEN may be used at other places, it's unconvenient to have it
redefined in a few files. Also, since checking it requires including
sys/param.h, some versions of it cause a macro declaration conflict
with MIN/MAX which are defined in tools.h. The solution consists in
including sys/param.h in both files so that we ensure it's loaded
before the macros are defined and MAXPATHLEN is checked.

include/common/compat.h
include/common/tools.h
src/proto_uxst.c

index 9eecdfbee6e51763854d4806ed0962d6c464f9b6..e134d5864fb8521724f4219b96ae2709e256898d 100644 (file)
@@ -1,30 +1,32 @@
 /*
-  include/common/compat.h
-  Operating system compatibility interface.
-
 Copyright (C) 2000-2008 Willy Tarreau - w@1wt.eu
-  
-  This library is free software; you can redistribute it and/or
-  modify it under the terms of the GNU Lesser General Public
-  License as published by the Free Software Foundation, version 2.1
-  exclusively.
-
-  This library is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public
-  License along with this library; if not, write to the Free Software
-  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-*/
* include/common/compat.h
* Operating system compatibility interface.
+ *
* Copyright (C) 2000-2010 Willy Tarreau - w@1wt.eu
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, version 2.1
* exclusively.
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 
 #ifndef _COMMON_COMPAT_H
 #define _COMMON_COMPAT_H
 
 /* This is needed on Linux for Netfilter includes */
+#include <sys/param.h>
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <arpa/inet.h>
 #include <common/config.h>
 #include <common/standard.h>
 
 #define MSG_MORE       0
 #endif
 
+/* Maximum path length, OS-dependant */
+#ifndef MAXPATHLEN
+#define MAXPATHLEN 128
+#endif
+
 #if defined(TPROXY) && defined(NETFILTER)
 #include <linux/types.h>
 #include <linux/netfilter_ipv6.h>
index 147783547f7514c0738e63b5d0a2b2e064832666..526ea7fbfaf420433fa23283d06cc06a115541d9 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef _COMMON_TOOLS_H
 #define _COMMON_TOOLS_H
 
+#include <sys/param.h>
 #include <common/config.h>
 
 #ifndef MIN
index 511753395f6b179608c032c2a46a7cc7a32f23f0..a1c83b0232f88d6ec12b64331b2f0539ffb53f6e 100644 (file)
@@ -19,7 +19,6 @@
 #include <syslog.h>
 #include <time.h>
 
-#include <sys/param.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <proto/stream_sock.h>
 #include <proto/task.h>
 
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 128
-#endif
-
 static int uxst_bind_listener(struct listener *listener, char *errmsg, int errlen);
 static int uxst_bind_listeners(struct protocol *proto, char *errmsg, int errlen);
 static int uxst_unbind_listeners(struct protocol *proto);