From 4f78fcb8728cd4bf31175b3fa610a5c003e915d1 Mon Sep 17 00:00:00 2001
From: Li xin <lixin.fnst@cn.fujitsu.com>
Date: Sun, 19 Jul 2015 02:42:58 +0900
Subject: [PATCH] Fixed swig host contamination issue

The audit build uses swig to generate a python wrapper.
Unfortunately, the swig info file references host include
directories.  Some of these were previously noticed and
eliminated, but the one fixed here was not.

Upstream-Status: Inappropriate [embedded specific]

Signed-off-by: Anders Hedlund <anders.hedlund@windriver.com>
Signed-off-by: Joe Slater <jslater@windriver.com>
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
---
 bindings/swig/python3/Makefile.am | 3 ++-
 bindings/swig/src/auditswig.i     | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/bindings/swig/python3/Makefile.am b/bindings/swig/python3/Makefile.am
index 428e40fa..f4dd45bc 100644
--- a/bindings/swig/python3/Makefile.am
+++ b/bindings/swig/python3/Makefile.am
@@ -23,6 +23,7 @@
 CONFIG_CLEAN_FILES = *.loT *.rej *.orig
 AM_CFLAGS = -fPIC -DPIC -fno-strict-aliasing $(PYTHON3_CFLAGS)
 AM_CPPFLAGS = -I. -I$(top_builddir) -I${top_srcdir}/lib $(PYTHON3_INCLUDES)
+STDINC ?= /usr/include
 LIBS = $(top_builddir)/lib/libaudit.la
 SWIG_FLAGS = -python
 SWIG_INCLUDES = -I. -I$(top_builddir) -I${top_srcdir}/lib $(PYTHON3_INCLUDES)
@@ -35,7 +36,7 @@ _audit_la_DEPENDENCIES =${top_srcdir}/lib/audit_logging.h ${top_builddir}/lib/li
 _audit_la_LIBADD = ${top_builddir}/lib/libaudit.la
 nodist__audit_la_SOURCES  = audit_wrap.c
 audit.py audit_wrap.c: ${srcdir}/../src/auditswig.i 
-	swig -o audit_wrap.c ${SWIG_FLAGS} ${SWIG_INCLUDES} ${srcdir}/../src/auditswig.i 
+	swig -o audit_wrap.c ${SWIG_FLAGS} ${SWIG_INCLUDES} -I$(STDINC) ${srcdir}/../src/auditswig.i
 
 CLEANFILES = audit.py* audit_wrap.c *~
 
diff --git a/bindings/swig/src/auditswig.i b/bindings/swig/src/auditswig.i
index 2760e516..5d0ea8b6 100644
--- a/bindings/swig/src/auditswig.i
+++ b/bindings/swig/src/auditswig.i
@@ -52,7 +52,7 @@ typedef unsigned uid_t;
  */
 %ignore audit_rule_data::buf;
 
-%include "/usr/include/linux/audit.h"
+%include "../lib/audit.h"
 #define __extension__ /*nothing*/
 %include <stdint.i>
 %include "../lib/audit-records.h"
