From d0735eae25c9943f5235efade4b42c4f12b0c315 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 22 Dec 2015 13:28:42 +0100 Subject: [PATCH] Fix SITL Linux compile error --- src/platforms/posix/main.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/platforms/posix/main.cpp b/src/platforms/posix/main.cpp index da0aed8d8c2..4d6663006de 100644 --- a/src/platforms/posix/main.cpp +++ b/src/platforms/posix/main.cpp @@ -227,7 +227,14 @@ int main(int argc, char **argv) // Lock this application in the current working dir // this is not an attempt to secure the environment, // rather, to replicate a deployed file system. - char pwd_path[PATH_MAX]; + +#ifdef PATH_MAX + const unsigned path_max_len = PATH_MAX; +#else + const unsigned path_max_len = 1024; +#endif + + char pwd_path[path_max_len]; const char *folderpath = "/rootfs/"; if (nullptr == getcwd(pwd_path, sizeof(pwd_path))) {