[PATCH 7/7] libbb.h: Handle missing HOST_NAME_MAX; ensure MAXFOOLEN agrees with FOO_MAX
Signed-off-by: James Clarke <jrtc27@jrtc27.com>
---
include/libbb.h | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/include/libbb.h b/include/libbb.h
index daccf154a..56f4f4cb3 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -181,7 +181,24 @@ extern char **environ;
/* klogctl is in libc's klog.h, but we cheat and not #include that */
int klogctl(int type, char *b, int len);
#ifndef PATH_MAX
-# define PATH_MAX 256
+# ifdef MAXPATHLEN
+# define PATH_MAX MAXPATHLEN
+# else
+# define PATH_MAX 256
+# endif
+#endif
+#ifndef MAXPATHLEN
+# define MAXPATHLEN PATH_MAX
+#endif
+#ifndef HOST_NAME_MAX
+# ifdef MAXHOSTNAMELEN
+# define HOST_NAME_MAX MAXHOSTNAMELEN
+# else
+# define HOST_NAME_MAX 256
+# endif
+#endif
+#ifndef MAXHOSTNAMELEN
+# define MAXHOSTNAMELEN HOST_NAME_MAX
#endif
#ifndef BUFSIZ
# define BUFSIZ 4096
--
2.14.1
Reply to: