File ghostscript-9.00-echogs.patch of Package ghostscript-library.887

rom: Hauke Klein <klein@math.uni-kiel.de>
To: gs-devel@ghostscript.com

Hi, while building ghostscript 8.62 with non-standard settings for
GLGENDIR, GLOBJDIR, ...
I noticed a few small inconsistencies in ghostscripts makefiles. The
attached patch should
fix these. I'm also building with a separate build directory.
Unfortunately, the resulting path
strings overflow a static buffer in echogs.c. The patch also changes
the size of these
buffers. I'm just including limits.h, I should probably guard this
with an HAVE_LIMITS_H
or something like this.

PS. I hope this message is appropriate for this list (or should gs-
code-review be
used for such things?)

--- base/echogs.c
+++ base/echogs.c	2010-09-28 12:56:09.159926344 +0000
@@ -31,6 +31,7 @@ extern int fputc(int, FILE *), fputs(con
 #include <ctype.h>
 #include <string.h>
 #include <time.h>		/* for ctime */
+#include <limits.h>
 
 /*
  * This program exists solely to get around omissions, problems, and
@@ -91,14 +92,14 @@ main(int argc, char *argv[])
     FILE *in = 0;
     const char *extn = "";
     char fmode[4];
-#define FNSIZE 1000
+#define FNSIZE PATH_MAX
     char *fnparam = NULL; /* Initialisation to shut up compilers */
     char fname[FNSIZE];
     int newline = 1;
     int interact = 0;
     int (*eputc)(int, FILE *) = fputc;
     int (*eputs)(const char *, FILE *) = fputs;
-#define LINESIZE 1000+FNSIZE
+#define LINESIZE 1000+PATH_MAX
     char line[LINESIZE];
     char sw = 0, sp = 0, hexx = 0;
     char **argp = argv + 1;
openSUSE Build Service is sponsored by