From f6b6982b014b540e9d3221cb801973e190195474 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 11 Dec 2016 22:09:34 +0000 Subject: [PATCH] better openbsd support --- .../platform/common/platform_common.cpp | 24 +++++++++---------- .../sources/platform/posix/socket.cpp | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/source/shared_lib/sources/platform/common/platform_common.cpp b/source/shared_lib/sources/platform/common/platform_common.cpp index 3033b425d..c6fbe6071 100644 --- a/source/shared_lib/sources/platform/common/platform_common.cpp +++ b/source/shared_lib/sources/platform/common/platform_common.cpp @@ -1093,7 +1093,7 @@ uint32 getFolderTreeContentsCheckSumRecursively(const string &path, const string glob_t globbuf; int res = glob(mypath.c_str(), 0, 0, &globbuf); -#if !defined(__APPLE__) && !defined(__FreeBSD__) +#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) if(res < 0) { std::stringstream msg; msg << "#2 Couldn't scan directory '" << mypath << "': " << strerror(errno); @@ -1127,13 +1127,13 @@ uint32 getFolderTreeContentsCheckSumRecursively(const string &path, const string globfree(&globbuf); // Look recursively for sub-folders -#if defined(__APPLE__) || defined(__FreeBSD__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) res = glob(mypath.c_str(), 0, 0, &globbuf); #else res = glob(mypath.c_str(), GLOB_ONLYDIR, 0, &globbuf); #endif -#if !defined(__APPLE__) && !defined(__FreeBSD__) +#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) if(res < 0) { std::stringstream msg; msg << "#3 Couldn't scan directory '" << mypath << "': " << strerror(errno); @@ -1142,7 +1142,7 @@ uint32 getFolderTreeContentsCheckSumRecursively(const string &path, const string #endif for(int i = 0; i < (int)globbuf.gl_pathc; ++i) { -#if defined(__APPLE__) || defined(__FreeBSD__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) struct stat statStruct; // only process if dir.. int actStat = lstat( globbuf.gl_pathv[i], &statStruct); @@ -1274,7 +1274,7 @@ vector getFolderTreeContentsListRecursively(const string &path, const st } int res = glob(mypath.c_str(), globFlags, 0, &globbuf); -#if !defined(__APPLE__) && !defined(__FreeBSD__) +#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) if(res < 0) { std::stringstream msg; msg << "#4 Couldn't scan directory '" << mypath << "': " << strerror(errno); @@ -1307,14 +1307,14 @@ vector getFolderTreeContentsListRecursively(const string &path, const st globfree(&globbuf); // Look recursively for sub-folders -#if defined(__APPLE__) || defined(__FreeBSD__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) res = glob(mypath.c_str(), 0, 0, &globbuf); #else //APPLE doesn't have the GLOB_ONLYDIR definition.. globFlags |= GLOB_ONLYDIR; res = glob(mypath.c_str(), globFlags, 0, &globbuf); #endif -#if !defined(__APPLE__) && !defined(__FreeBSD__) +#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) if(res < 0) { std::stringstream msg; msg << "#5 Couldn't scan directory '" << mypath << "': " << strerror(errno); @@ -1323,7 +1323,7 @@ vector getFolderTreeContentsListRecursively(const string &path, const st #endif for(int i = 0; i < (int)globbuf.gl_pathc; ++i) { -#if defined(__APPLE__) || defined(__FreeBSD__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) struct stat statStruct; // only get if dir.. int actStat = lstat( globbuf.gl_pathv[ i], &statStruct); @@ -1415,7 +1415,7 @@ vector > getFolderTreeContentsCheckSumListRecursively(c int res = glob(mypath.c_str(), 0, 0, &globbuf); -#if !defined(__APPLE__) && !defined(__FreeBSD__) +#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) if(res < 0) { std::stringstream msg; msg << "#6 Couldn't scan directory '" << mypath << "': " << strerror(errno); @@ -1447,13 +1447,13 @@ vector > getFolderTreeContentsCheckSumListRecursively(c globfree(&globbuf); // Look recursively for sub-folders -#if defined(__APPLE__) || defined(__FreeBSD__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) res = glob(mypath.c_str(), 0, 0, &globbuf); #else //APPLE doesn't have the GLOB_ONLYDIR definition.. res = glob(mypath.c_str(), GLOB_ONLYDIR, 0, &globbuf); #endif -#if !defined(__APPLE__) && !defined(__FreeBSD__) +#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) if(res < 0) { std::stringstream msg; msg << "#7 Couldn't scan directory '" << mypath << "': " << strerror(errno); @@ -1462,7 +1462,7 @@ vector > getFolderTreeContentsCheckSumListRecursively(c #endif for(int i = 0; i < (int)globbuf.gl_pathc; ++i) { -#if defined(__APPLE__) || defined(__FreeBSD__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) struct stat statStruct; // only get if dir.. int actStat = lstat( globbuf.gl_pathv[ i], &statStruct); diff --git a/source/shared_lib/sources/platform/posix/socket.cpp b/source/shared_lib/sources/platform/posix/socket.cpp index bc6dda040..0ff85950b 100644 --- a/source/shared_lib/sources/platform/posix/socket.cpp +++ b/source/shared_lib/sources/platform/posix/socket.cpp @@ -319,7 +319,7 @@ string Ip::getString() const{ // class Socket // =============================================== -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(BSD) || defined(__APPLE__) || defined(__linux__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(BSD) || defined(__APPLE__) || defined(__linux__) # define USE_GETIFADDRS 1 # include #endif