Navigation Menu

Skip to content

Commit

Permalink
better openbsd support
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Dec 11, 2016
1 parent 49ba518 commit f6b6982
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions source/shared_lib/sources/platform/common/platform_common.cpp
Expand Up @@ -1093,7 +1093,7 @@ uint32 getFolderTreeContentsCheckSumRecursively(const string &path, const string
glob_t globbuf; glob_t globbuf;


int res = glob(mypath.c_str(), 0, 0, &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) { if(res < 0) {
std::stringstream msg; std::stringstream msg;
msg << "#2 Couldn't scan directory '" << mypath << "': " << strerror(errno); msg << "#2 Couldn't scan directory '" << mypath << "': " << strerror(errno);
Expand Down Expand Up @@ -1127,13 +1127,13 @@ uint32 getFolderTreeContentsCheckSumRecursively(const string &path, const string
globfree(&globbuf); globfree(&globbuf);


// Look recursively for sub-folders // 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); res = glob(mypath.c_str(), 0, 0, &globbuf);
#else #else
res = glob(mypath.c_str(), GLOB_ONLYDIR, 0, &globbuf); res = glob(mypath.c_str(), GLOB_ONLYDIR, 0, &globbuf);
#endif #endif


#if !defined(__APPLE__) && !defined(__FreeBSD__) #if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
if(res < 0) { if(res < 0) {
std::stringstream msg; std::stringstream msg;
msg << "#3 Couldn't scan directory '" << mypath << "': " << strerror(errno); msg << "#3 Couldn't scan directory '" << mypath << "': " << strerror(errno);
Expand All @@ -1142,7 +1142,7 @@ uint32 getFolderTreeContentsCheckSumRecursively(const string &path, const string
#endif #endif


for(int i = 0; i < (int)globbuf.gl_pathc; ++i) { 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; struct stat statStruct;
// only process if dir.. // only process if dir..
int actStat = lstat( globbuf.gl_pathv[i], &statStruct); int actStat = lstat( globbuf.gl_pathv[i], &statStruct);
Expand Down Expand Up @@ -1274,7 +1274,7 @@ vector<string> getFolderTreeContentsListRecursively(const string &path, const st
} }


int res = glob(mypath.c_str(), globFlags, 0, &globbuf); int res = glob(mypath.c_str(), globFlags, 0, &globbuf);
#if !defined(__APPLE__) && !defined(__FreeBSD__) #if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
if(res < 0) { if(res < 0) {
std::stringstream msg; std::stringstream msg;
msg << "#4 Couldn't scan directory '" << mypath << "': " << strerror(errno); msg << "#4 Couldn't scan directory '" << mypath << "': " << strerror(errno);
Expand Down Expand Up @@ -1307,14 +1307,14 @@ vector<string> getFolderTreeContentsListRecursively(const string &path, const st
globfree(&globbuf); globfree(&globbuf);


// Look recursively for sub-folders // 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); res = glob(mypath.c_str(), 0, 0, &globbuf);
#else //APPLE doesn't have the GLOB_ONLYDIR definition.. #else //APPLE doesn't have the GLOB_ONLYDIR definition..
globFlags |= GLOB_ONLYDIR; globFlags |= GLOB_ONLYDIR;
res = glob(mypath.c_str(), globFlags, 0, &globbuf); res = glob(mypath.c_str(), globFlags, 0, &globbuf);
#endif #endif


#if !defined(__APPLE__) && !defined(__FreeBSD__) #if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
if(res < 0) { if(res < 0) {
std::stringstream msg; std::stringstream msg;
msg << "#5 Couldn't scan directory '" << mypath << "': " << strerror(errno); msg << "#5 Couldn't scan directory '" << mypath << "': " << strerror(errno);
Expand All @@ -1323,7 +1323,7 @@ vector<string> getFolderTreeContentsListRecursively(const string &path, const st
#endif #endif


for(int i = 0; i < (int)globbuf.gl_pathc; ++i) { 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; struct stat statStruct;
// only get if dir.. // only get if dir..
int actStat = lstat( globbuf.gl_pathv[ i], &statStruct); int actStat = lstat( globbuf.gl_pathv[ i], &statStruct);
Expand Down Expand Up @@ -1415,7 +1415,7 @@ vector<std::pair<string,uint32> > getFolderTreeContentsCheckSumListRecursively(c


int res = glob(mypath.c_str(), 0, 0, &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) { if(res < 0) {
std::stringstream msg; std::stringstream msg;
msg << "#6 Couldn't scan directory '" << mypath << "': " << strerror(errno); msg << "#6 Couldn't scan directory '" << mypath << "': " << strerror(errno);
Expand Down Expand Up @@ -1447,13 +1447,13 @@ vector<std::pair<string,uint32> > getFolderTreeContentsCheckSumListRecursively(c
globfree(&globbuf); globfree(&globbuf);


// Look recursively for sub-folders // 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); res = glob(mypath.c_str(), 0, 0, &globbuf);
#else //APPLE doesn't have the GLOB_ONLYDIR definition.. #else //APPLE doesn't have the GLOB_ONLYDIR definition..
res = glob(mypath.c_str(), GLOB_ONLYDIR, 0, &globbuf); res = glob(mypath.c_str(), GLOB_ONLYDIR, 0, &globbuf);
#endif #endif


#if !defined(__APPLE__) && !defined(__FreeBSD__) #if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
if(res < 0) { if(res < 0) {
std::stringstream msg; std::stringstream msg;
msg << "#7 Couldn't scan directory '" << mypath << "': " << strerror(errno); msg << "#7 Couldn't scan directory '" << mypath << "': " << strerror(errno);
Expand All @@ -1462,7 +1462,7 @@ vector<std::pair<string,uint32> > getFolderTreeContentsCheckSumListRecursively(c
#endif #endif


for(int i = 0; i < (int)globbuf.gl_pathc; ++i) { 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; struct stat statStruct;
// only get if dir.. // only get if dir..
int actStat = lstat( globbuf.gl_pathv[ i], &statStruct); int actStat = lstat( globbuf.gl_pathv[ i], &statStruct);
Expand Down
2 changes: 1 addition & 1 deletion source/shared_lib/sources/platform/posix/socket.cpp
Expand Up @@ -319,7 +319,7 @@ string Ip::getString() const{
// class Socket // 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 # define USE_GETIFADDRS 1
# include <ifaddrs.h> # include <ifaddrs.h>
#endif #endif
Expand Down

0 comments on commit f6b6982

Please sign in to comment.