summaryrefslogtreecommitdiff
path: root/lib/intercept
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2014-12-10 23:27:59 +0000
committerChris Wilson <chris+github@qwirx.com>2014-12-10 23:27:59 +0000
commit5475701ecfb8334092b36fd1258c19096da7c1f6 (patch)
treea75a770df43a4d8604279ecf72574efcab1622c8 /lib/intercept
parent686cebb5face263b740bd98215c21ddb32beebe3 (diff)
Fix intercept tests on NetBSD.
Thanks to Jose Luis Rodriguez Garcia for the patch!
Diffstat (limited to 'lib/intercept')
-rw-r--r--lib/intercept/intercept.cpp4
-rw-r--r--lib/intercept/intercept.h12
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/intercept/intercept.cpp b/lib/intercept/intercept.cpp
index ee79fe00..41a7333b 100644
--- a/lib/intercept/intercept.cpp
+++ b/lib/intercept/intercept.cpp
@@ -514,7 +514,7 @@ DIR *opendir(const char *dirname)
{
if (opendir_real == NULL)
{
- opendir_real = (opendir_t*)find_function("opendir");
+ opendir_real = (opendir_t*)find_function(FUNC_OPENDIR);
}
if (opendir_real == NULL)
@@ -547,7 +547,7 @@ struct dirent *readdir(DIR *dir)
if (readdir_real == NULL)
{
- readdir_real = (readdir_t*)find_function("readdir");
+ readdir_real = (readdir_t*)find_function(FUNC_READDIR);
}
if (readdir_real == NULL)
diff --git a/lib/intercept/intercept.h b/lib/intercept/intercept.h
index 80a17d3f..c0d61638 100644
--- a/lib/intercept/intercept.h
+++ b/lib/intercept/intercept.h
@@ -13,6 +13,18 @@
#include <dirent.h>
+#ifdef __NetBSD__ //__NetBSD_Version__ is defined in sys/param.h
+#include <sys/param.h>
+#endif
+
+#if defined __NetBSD_Version__ && __NetBSD_Version__ >= 399000800 //3.99.8 vers.
+#define FUNC_OPENDIR "__opendir30"
+#define FUNC_READDIR "__readdir30"
+#else
+#define FUNC_OPENDIR "opendir"
+#define FUNC_READDIR "readdir"
+#endif
+
#include <sys/types.h>
#include <sys/stat.h>