From da5780e1cd4bbf9a267138f1cc5fff6c4e7d76d7 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Sat, 12 Jan 2013 01:04:46 +0100 Subject: [PATCH] Introduce CPH_PATH_MAX PATH_MAX is optional in POSIX, and not provided on GNU/Hurd; due to the shotcoming of cupsTempFile2(), a dynamically allocated buffer cannot be provided, so define CPH_PATH_MAX as PATH_MAX (or 1024, if not available), and use it. --- src/cups.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cups.c b/src/cups.c index 92425eb..31db6df 100644 --- a/src/cups.c +++ b/src/cups.c @@ -278,6 +278,12 @@ cph_cups_new (void) */ #define CPH_STR_MAXLEN 512 +#ifdef PATH_MAX +# define CPH_PATH_MAX PATH_MAX +#else +# define CPH_PATH_MAX 1024 +#endif + static gboolean _cph_cups_is_string_printable (const char *str, gboolean check_for_null, @@ -2391,7 +2397,7 @@ _cph_cups_prepare_ppd_for_options (CphCups *cups, gboolean ppdchanged = FALSE; gchar *result = NULL; gchar *error; - char newppdfile[PATH_MAX]; + char newppdfile[CPH_PATH_MAX]; cups_file_t *in = NULL; cups_file_t *out = NULL; char line[CPH_STR_MAXLEN]; -- 1.7.10.4