pmake (1.111-2+squeeze1) 130_maxpathlen.diff

Summary

 main.c |   11 +++++++++++
 make.h |    6 ++++++
 2 files changed, 17 insertions(+)

    
download this patch

Patch contents

diff -u pmake-1.111/main.c pmake-1.111/main.c
--- pmake-1.111/main.c
+++ pmake-1.111/main.c
@@ -636,6 +636,17 @@
 	char found_path[MAXPATHLEN + 1];	/* for searching for sys.mk */
 	struct timeval rightnow;		/* to initialize random seed */
 
+#ifdef MAXPATHLEN_UNDEFINED
+	if (sysconf(_PC_PATH_MAX) > MAXPATHLEN) {
+		fprintf(stderr, "This operating system runs with "
+		    "sysconf(_PC_PATH_MAX) > MAXPATHLEN\n(%ld > %ld). "
+		    "Please change the guesstimated value at the bottom\n"
+		    "of 'make.h' and recompile, or reduce the actual "
+		    "value.\n", sysconf(_PC_PATH_MAX), (long)MAXPATHLEN);
+		return (255);
+	}
+#endif
+
 	/*
 	 * Set the seed to produce a different random sequences
 	 * on each program execution.
--- pmake-1.111.orig/make.h
+++ pmake-1.111/make.h
@@ -476,4 +476,10 @@
 #define MAX(a, b) ((a > b) ? a : b)
 #endif
 
+/* maybe Debian GNU/HURD */
+#ifndef MAXPATHLEN
+#define MAXPATHLEN	4096	/* some sensible value */
+#define MAXPATHLEN_UNDEFINED	/* triggers check in main.c */
+#endif
+
 #endif /* _MAKE_H_ */