summaryrefslogtreecommitdiff
path: root/Src/system.h
diff options
context:
space:
mode:
Diffstat (limited to 'Src/system.h')
-rw-r--r--Src/system.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/Src/system.h b/Src/system.h
index cba80a5f6..ba83e005e 100644
--- a/Src/system.h
+++ b/Src/system.h
@@ -194,8 +194,8 @@ struct timezone {
# define VARARR(X,Y,Z) X *(Y) = (X *) alloca(sizeof(X) * (Z))
#endif
-/* we should be getting this value from pathconf(_PC_PATH_MAX) */
-/* but this is too much trouble */
+/* we should handle unlimited sizes from pathconf(_PC_PATH_MAX) */
+/* but this is too much trouble */
#ifndef PATH_MAX
# ifdef MAXPATHLEN
# define PATH_MAX MAXPATHLEN
@@ -204,6 +204,11 @@ struct timezone {
# define PATH_MAX 1024
# endif
#endif
+#ifndef HAVE_PATHCONF
+# define zpathmax(X) ((long)((strlen(X) >= PATH_MAX) ? \
+ ((errno = ENAMETOOLONG), -1) : \
+ ((errno = 0), PATH_MAX))
+#endif
/* we should be getting this value from sysconf(_SC_OPEN_MAX) */
/* but this is too much trouble */