diff options
-rw-r--r-- | include/inspircd.h | 4 | ||||
-rw-r--r-- | src/configreader.cpp | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/include/inspircd.h b/include/inspircd.h index 7a06f299c..13a94331a 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -31,6 +31,10 @@ #define CUSTOM_PRINTF(STRING, FIRST) #endif +#ifndef PATH_MAX +#define PATH_MAX 4096 +#endif + // Required system headers. #include <ctime> #include <cstdarg> diff --git a/src/configreader.cpp b/src/configreader.cpp index 19f5cc21c..ad0e972f9 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -2071,7 +2071,7 @@ bool ServerConfig::DirValid(const char* dirandfile) std::string ServerConfig::GetFullProgDir() { - char buffer[4096]; + char buffer[PATH_MAX]; #ifdef WINDOWS /* Windows has specific api calls to get the exe path that never fail. * For once, windows has something of use, compared to the POSIX code @@ -2085,7 +2085,7 @@ std::string ServerConfig::GetFullProgDir() } #else // Get the current working directory - if (getcwd(buffer, 4096)) + if (getcwd(buffer, PATH_MAX)) { std::string remainder = this->argv[0]; |