commit:     ca6b86be44fc7ed618a7ab3bd021e208d38878b1
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu Oct 23 23:47:04 2014 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Oct 23 23:47:24 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=ca6b86be

Fix all tests for GNU/kFreeBSD

It is necessary to check for both the kernel and c library because
__FreeBSD_kernel is also defined on native FreeBSD [1].

[1] http://sourceforge.net/p/predef/wiki/OperatingSystems/

---
 src/librc/librc-daemon.c | 2 +-
 src/librc/rc.h.in        | 3 ++-
 src/rc/mountinfo.c       | 6 ++++--
 src/rc/rc-logger.c       | 2 +-
 src/rc/runscript.c       | 3 ++-
 5 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/librc/librc-daemon.c b/src/librc/librc-daemon.c
index 9970315..d19c3a3 100644
--- a/src/librc/librc-daemon.c
+++ b/src/librc/librc-daemon.c
@@ -30,7 +30,7 @@
 
 #include "librc.h"
 
-#if defined(__linux__) || defined (__FreeBSD_kernel__)
+#if defined(__linux__) || (defined (__FreeBSD_kernel__) && defined(__GLIBC__))
 static bool
 pid_is_exec(pid_t pid, const char *exec)
 {

diff --git a/src/librc/rc.h.in b/src/librc/rc.h.in
index 34f09f2..fca0dda 100644
--- a/src/librc/rc.h.in
+++ b/src/librc/rc.h.in
@@ -42,7 +42,8 @@ extern "C" {
 #define RC_LIBEXECDIR           "@LIBEXECDIR@"
 #if defined(PREFIX)
 #define RC_SVCDIR               RC_LIBEXECDIR "/init.d"
-#elif defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
+#elif defined(__linux__) || (defined(__FreeBSD_kernel__) && \
+               defined(__GLIBC__)) || defined(__GNU__)
 #define RC_SVCDIR               "/run/openrc"
 #else
 #define RC_SVCDIR               RC_LIBEXECDIR "/init.d"

diff --git a/src/rc/mountinfo.c b/src/rc/mountinfo.c
index c4515ae..fbad6af 100644
--- a/src/rc/mountinfo.c
+++ b/src/rc/mountinfo.c
@@ -39,7 +39,8 @@
 #  include <sys/statvfs.h>
 #  define statfs statvfs
 #  define F_FLAGS f_flag
-#elif defined (__linux__) || defined (__FreeBSD_kernel__) || defined(__GNU__)
+#elif defined (__linux__) || (defined(__FreeBSD_kernel__) && \
+               defined(__GLIBC__)) || defined(__GNU__)
 #  include <mntent.h>
 #endif
 
@@ -265,7 +266,8 @@ find_mounts(struct args *args)
        return list;
 }
 
-#elif defined (__linux__) || defined (__FreeBSD_kernel__)
+#elif defined (__linux__) || (defined (__FreeBSD_kernel__) && \
+               defined(__GLIBC__))
 static struct mntent *
 getmntfile(const char *file)
 {

diff --git a/src/rc/rc-logger.c b/src/rc/rc-logger.c
index 50cf618..89eb84b 100644
--- a/src/rc/rc-logger.c
+++ b/src/rc/rc-logger.c
@@ -44,7 +44,7 @@
 #include <time.h>
 #include <unistd.h>
 
-#if defined(__linux__) || defined(__FreeBSD_kernel__)
+#if defined(__linux__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
 #  include <pty.h>
 #elif defined(__NetBSD__) || defined(__OpenBSD__)
 #  include <util.h>

diff --git a/src/rc/runscript.c b/src/rc/runscript.c
index 96aa683..47ed23e 100644
--- a/src/rc/runscript.c
+++ b/src/rc/runscript.c
@@ -51,7 +51,8 @@
 #include <time.h>
 #include <unistd.h>
 
-#if defined(__linux__) || defined(__FreeBSD_kernel__)
+#if defined(__linux__) || (defined(__FreeBSD_kernel__) && \
+               defined(__GLIBC__))
 #  include <pty.h>
 #elif defined(__NetBSD__) || defined(__OpenBSD__)
 #  include <util.h>

Reply via email to