diff --git a/CHANGES b/CHANGES index 2fc999f67e..19ac4ff520 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ v3.0.3 - YYYY-MMM-DD (to be released) ------------------------------------- + - Fix OpenBSD build + [Issue #1841 - @victorhora, @zimmerle, @juanfra684] - Variable names must match fully, not partially. Match should be case insensitive. [Issue #1818, #1820, #1810, #1808 - @michaelgranzow-avi, @victorhora, diff --git a/configure.ac b/configure.ac index 38c8eccbe0..b6dabe59ef 100644 --- a/configure.ac +++ b/configure.ac @@ -332,7 +332,7 @@ AM_CONDITIONAL([USE_MUTEX_ON_PM], [test $mutexPm = true]) # General link options -if test "$PLATFORM" != "MacOSX"; then +if test "$PLATFORM" != "MacOSX" -a "$PLATFORM" != "OpenBSD"; then GLOBAL_LDADD="-lrt " fi diff --git a/examples/multiprocess_c/multi.c b/examples/multiprocess_c/multi.c index df2a27338d..caff92b5d7 100644 --- a/examples/multiprocess_c/multi.c +++ b/examples/multiprocess_c/multi.c @@ -22,6 +22,7 @@ #include #include #include +#include #define FORKS 5 #define REQUESTS_PER_PROCESS 100 diff --git a/src/utils/string.cc b/src/utils/string.cc index 4732eec498..37c20a0def 100644 --- a/src/utils/string.cc +++ b/src/utils/string.cc @@ -17,7 +17,11 @@ #include #include #include +#ifdef __OpenBSD__ +#include +#else #include +#endif #include #include diff --git a/src/utils/system.cc b/src/utils/system.cc index d832640edd..730999e99f 100644 --- a/src/utils/system.cc +++ b/src/utils/system.cc @@ -17,7 +17,11 @@ #include #include #include +#ifdef __OpenBSD__ +#include +#else #include +#endif #include #include @@ -119,10 +123,17 @@ std::string get_path(const std::string& file) { std::list expandEnv(const std::string& var, int flags) { std::list vars; +#ifdef __OpenBSD__ + glob_t p; + if (glob(var.c_str(), flags, NULL, &p) == false) { + if (p.gl_pathc) { + for (char** exp = p.gl_pathv; *exp; ++exp) { +#else wordexp_t p; if (wordexp(var.c_str(), &p, flags) == false) { if (p.we_wordc) { for (char** exp = p.we_wordv; *exp; ++exp) { +#endif std::ifstream *iss = new std::ifstream(exp[0], std::ios::in); if (iss->is_open()) { iss->close(); @@ -131,12 +142,15 @@ std::list expandEnv(const std::string& var, int flags) { delete iss; } } +#ifdef __OpenBSD__ + globfree(&p); +#else wordfree(&p); +#endif } return vars; } - bool createDir(std::string dir, int mode, std::string *error) { int ret = mkdir(dir.data(), mode); if (ret != 0 && errno != EEXIST) {