[test-suite] r190918 - Fix a buildbot test failure caused by paths longer than the expected 200 characters. Replace path buffer size with the standard PATH_MAX from limits.h. I think this is a very safe change, but please revert if it causes problems.

Chris Matthews cmatthews5 at apple.com
Tue Sep 17 21:24:58 PDT 2013


Author: cmatthews
Date: Tue Sep 17 23:24:57 2013
New Revision: 190918

URL: http://llvm.org/viewvc/llvm-project?rev=190918&view=rev
Log:
Fix a buildbot test failure caused by paths longer than the expected 200 characters.  Replace path buffer size with the standard PATH_MAX from limits.h. I think this is a very safe change, but please revert if it causes problems.

Modified:
    test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zfile.c

Modified: test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zfile.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zfile.c?rev=190918&r1=190917&r2=190918&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zfile.c (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zfile.c Tue Sep 17 23:24:57 2013
@@ -19,6 +19,7 @@ copies.  */
 
 /* zfile.c */
 /* File operators for GhostScript */
+#include <limits.h>
 #include "memory_.h"
 #include "string_.h"
 #include "ghost.h"
@@ -679,8 +680,7 @@ int
 lib_file_open(byte *fname, uint len, ref *pfile)
 {	int code;
 	char **ppath;
-#define max_len 200
-	char cname[max_len];
+	char cname[PATH_MAX];
 	code = file_open(fname, len, "r", pfile);
 	if ( code >= 0 ) return code;
 	if ( gp_file_name_is_absolute((char *)fname, len) )
@@ -701,7 +701,7 @@ lib_file_open(byte *fname, uint len, ref
 							  (char *)fname, len);
 			/* Concatenate the prefix, combiner, and file name. */
 			clen = plen + strlen(cstr) + len;
-			if ( clen <= max_len )	/* otherwise punt */
+			if ( clen <= PATH_MAX )	/* otherwise punt */
 			   {	memcpy(cname, path, plen);
 				strcpy(cname + plen, cstr);
 				memcpy(cname + clen - len, fname, len);





More information about the llvm-commits mailing list