about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2015-09-06 19:40:41 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2015-09-06 19:40:41 +0200
commit9317704719ca93d15cf1a26d08e2e767ee3b0c93 (patch)
tree269d93e5a5e0643d8a012945173191eb786274a3
parent6acb10fc71441e95909398a59906b18e04cf314d (diff)
downloadredo-c-9317704719ca93d15cf1a26d08e2e767ee3b0c93.tar.gz
redo-c-9317704719ca93d15cf1a26d08e2e767ee3b0c93.tar.xz
redo-c-9317704719ca93d15cf1a26d08e2e767ee3b0c93.zip
Use PATH_MAX for filename buffers
-rw-r--r--redo.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/redo.c b/redo.c
index 6963c90..446b810 100644
--- a/redo.c
+++ b/redo.c
@@ -26,6 +26,7 @@ todo:
   test job server properly
 */
 
+#include <sys/param.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -203,7 +204,7 @@ redo_ifcreate(char *target)
 static char *
 check_dofile(const char *fmt, ...)
 {
-	static char dofile[1024];
+	static char dofile[PATH_MAX];
 
 	va_list ap;
 	va_start(ap, fmt);
@@ -229,7 +230,7 @@ this function assumes no / in target
 static char *
 find_dofile(char *target)
 {
-	char updir[1024];
+	char updir[PATH_MAX];
 	char *u = updir;
 	char *dofile, *s;
 	struct stat st, ost;
@@ -368,16 +369,16 @@ targetchdir(char *target) {
 
 static char *
 targetdep(char *target) {
-	static char dep[1024];
-	snprintf(dep, sizeof dep, ".dep.%s", target);
-	return dep;
+	static char buf[PATH_MAX];
+	snprintf(buf, sizeof buf, ".dep.%s", target);
+	return buf;
 }
 
 static char *
 targetlock(char *target) {
-	static char dep[1024];
-	snprintf(dep, sizeof dep, ".lock.%s", target);
-	return dep;
+	static char buf[PATH_MAX];
+	snprintf(buf, sizeof buf, ".lock.%s", target);
+	return buf;
 }
 
 static int
@@ -542,7 +543,7 @@ run_script(char *target, int implicit)
 {
 	char temp_depfile[] = ".depend.XXXXXX";
 	char temp_target_base[] = ".target.XXXXXX";
-	char temp_target[1024], rel_target[1024], cwd[1024];
+	char temp_target[PATH_MAX], rel_target[PATH_MAX], cwd[PATH_MAX];
 	char *orig_target = target;
 	int old_dep_fd = dep_fd;
 	int target_fd;