PATH_MAX is not defined on linux when building with `-std=c99`
schodet opened this issue · comments
Nicolas Schodet commented
Actually documentation says that it can be undefined if no real limit is applicable.
Would this be OK?:
diff --git a/tinydir.h b/tinydir.h
index 324f9f6..7863564 100644
--- a/tinydir.h
+++ b/tinydir.h
@@ -89,7 +89,9 @@ extern "C" {
# define _TINYDIR_PATH_MAX MAX_PATH
#elif defined __linux__
# include <limits.h>
-# define _TINYDIR_PATH_MAX PATH_MAX
+# ifdef PATH_MAX
+# define _TINYDIR_PATH_MAX PATH_MAX
+# endif
#elif defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
# include <sys/param.h>
# if defined(BSD)
Cong commented
which documentation is this?
I guess this change looks safe
Nicolas Schodet commented
Here is an extract from the glibc documentation:
Each of the following macros is defined in limits.h only if the system has a fixed, uniform limit for the parameter in question. If the system allows different file systems or files to have different limits, then the macro is undefined
https://www.gnu.org/software/libc/manual/html_node/Limits-for-Files.html#Limits-for-Files
Nicolas Schodet commented
Thanks :-)