summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPino Toscano <toscano.pino@tiscali.it>2013-01-12 01:04:46 +0100
committerMarek Kasik <mkasik@redhat.com>2016-01-28 13:14:12 +0100
commitcbc8af906c262b401438b005bfc6a24074f9524f (patch)
treeab93d18d43ebd25ae4ff76002116371b56f19843
parent983e8eafc051ca81a45d66477502c89cd5f4cbc1 (diff)
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. https://bugs.freedesktop.org/show_bug.cgi?id=59263
-rw-r--r--src/cups.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cups.c b/src/cups.c
index 2b69cab..55de519 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,
@@ -2636,7 +2642,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];