Patchwork [2/2] build: resolve compile abort in libxt_limit on RHEL5

login
register
mail settings
Submitter Jan Engelhardt
Date Oct. 10, 2012, 10:35 a.m.
Message ID <1349865314-27640-3-git-send-email-jengelh@inai.de>
Download mbox | patch
Permalink /patch/190608/
State Accepted
Headers show

Comments

Jan Engelhardt - Oct. 10, 2012, 10:35 a.m.
libxt_limit.c: In function 'print_rate':
	libxt_limit.c:124: error: 'INFINITY' undeclared (first use in
	this function)

The default mode of glibc-2.15's <features.h> sets
"-D_POSIX_C_SOURCE=200809L", and therefore "-D_ISOC99_SOURCE". However,
on þe olde RHEL 5's glibc-2.5, it only has "-D_POSIX_C_SOURCE=200112L".

Explicitly draw in the definition of INFINITY by always defining
_ISOC99_SOURCE. By doing this, we are moving off of the default set, so
_BSD_SOURCE also needs to be explicitly set to get at IFNAMSIZ that is
used in xt_hashlimit.h.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
---
 extensions/libxt_hashlimit.c |    2 ++
 extensions/libxt_limit.c     |    2 ++
 2 files changed, 4 insertions(+)
Pablo Neira - Oct. 10, 2012, 11:29 a.m.
On Wed, Oct 10, 2012 at 12:35:14PM +0200, Jan Engelhardt wrote:
> 	libxt_limit.c: In function 'print_rate':
> 	libxt_limit.c:124: error: 'INFINITY' undeclared (first use in
> 	this function)
> 
> The default mode of glibc-2.15's <features.h> sets
> "-D_POSIX_C_SOURCE=200809L", and therefore "-D_ISOC99_SOURCE". However,
> on þe olde RHEL 5's glibc-2.5, it only has "-D_POSIX_C_SOURCE=200112L".
> 
> Explicitly draw in the definition of INFINITY by always defining
> _ISOC99_SOURCE. By doing this, we are moving off of the default set, so
> _BSD_SOURCE also needs to be explicitly set to get at IFNAMSIZ that is
> used in xt_hashlimit.h.

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/extensions/libxt_hashlimit.c b/extensions/libxt_hashlimit.c
index 831345b..c5b8d77 100644
--- a/extensions/libxt_hashlimit.c
+++ b/extensions/libxt_hashlimit.c
@@ -10,6 +10,8 @@ 
  * 
  * Error corections by nmalykh@bilim.com (22.01.2005)
  */
+#define _BSD_SOURCE 1
+#define _ISOC99_SOURCE 1
 #include <math.h>
 #include <stdbool.h>
 #include <stdint.h>
diff --git a/extensions/libxt_limit.c b/extensions/libxt_limit.c
index 023500c..f75ef2f 100644
--- a/extensions/libxt_limit.c
+++ b/extensions/libxt_limit.c
@@ -3,6 +3,8 @@ 
  * Jérôme de Vivie   <devivie@info.enserb.u-bordeaux.fr>
  * Hervé Eychenne    <rv@wallfire.org>
  */
+#define _BSD_SOURCE 1
+#define _ISOC99_SOURCE 1
 #include <math.h>
 #include <stdio.h>
 #include <string.h>