[Open-scap] [PATCH] Fix build on Debian/kFreeBSD

Pierre Chifflier chifflier at edenwall.com
Thu Aug 12 08:34:58 UTC 2010


This fixes the build on Debian/kFreeBSD (Debian userland with FreeBSD kernel)
by checking the __GLIBC__ and __FreeBSD_kernel__ defines.
Thanks to Petr Salinger and Jakub Wilk for the patches.

Signed-off-by: Pierre Chifflier <chifflier at edenwall.com>
---
 src/OVAL/probes/fsdev.c         |    4 ++--
 src/OVAL/probes/unix/file.c     |    2 +-
 src/OVAL/probes/unix/runlevel.c |    2 +-
 tests/OVAL/SEAP/sexp_parser.c   |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/OVAL/probes/fsdev.c b/src/OVAL/probes/fsdev.c
index e42b3cd..ebb45d3 100644
--- a/src/OVAL/probes/fsdev.c
+++ b/src/OVAL/probes/fsdev.c
@@ -40,7 +40,7 @@
 #if defined(__linux__)
 # include <mntent.h>
 # include <unistd.h>
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 # include <sys/param.h>
 # include <sys/ucred.h>
 # include <sys/mount.h>
@@ -171,7 +171,7 @@ static fsdev_t *__fsdev_init(fsdev_t * lfs, const char **fs, size_t fs_cnt)
 
 	return (lfs);
 }
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 static fsdev_t *__fsdev_init(fsdev_t * lfs, const char **fs, size_t fs_cnt)
 {
 	struct statfs *mntbuf = NULL;
diff --git a/src/OVAL/probes/unix/file.c b/src/OVAL/probes/unix/file.c
index 6aae82f..3a5b54a 100644
--- a/src/OVAL/probes/unix/file.c
+++ b/src/OVAL/probes/unix/file.c
@@ -55,7 +55,7 @@
 
 #if defined(__FreeBSD__)
 # define OS_FREEBSD
-#elif defined(__linux__)
+#elif defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)
 # define OS_LINUX
 #elif defined(sun) || defined(__sun)
 # if defined(__SVR4) || defined(__svr4__)
diff --git a/src/OVAL/probes/unix/runlevel.c b/src/OVAL/probes/unix/runlevel.c
index 0c28867..9a699ec 100644
--- a/src/OVAL/probes/unix/runlevel.c
+++ b/src/OVAL/probes/unix/runlevel.c
@@ -79,7 +79,7 @@ struct runlevel_rep {
 
 static int get_runlevel (struct runlevel_req *req, struct runlevel_rep **rep);
 
-#if defined(__linux__)
+#if defined(__linux__) || defined(__GLIBC__)
 static int get_runlevel_redhat (struct runlevel_req *req, struct runlevel_rep **rep)
 {
 	const char runlevel_list[] = {'0', '1', '2', '3', '4', '5', '6'};
diff --git a/tests/OVAL/SEAP/sexp_parser.c b/tests/OVAL/SEAP/sexp_parser.c
index 123529c..c162cb2 100644
--- a/tests/OVAL/SEAP/sexp_parser.c
+++ b/tests/OVAL/SEAP/sexp_parser.c
@@ -49,7 +49,7 @@ int main (int argc, char *argv[])
 
 #if defined(__FreeBSD__)
                         input = fgetln (stdin, &inlen);
-#elif defined(__linux__)
+#elif defined(__linux__) || defined(__GLIBC__)
                         getline (&input, &inlen, stdin);
 #else
 # error "FIXME"
-- 
1.7.1




More information about the Open-scap-list mailing list