diff --git a/ppd/debug.c b/ppd/debug.c index c002952e..992409bb 100644 --- a/ppd/debug.c +++ b/ppd/debug.c @@ -257,7 +257,7 @@ _ppd_debug_set(const char *logfile, // I - Log file or NULL { char buffer[1024]; // Filename buffer - snprintf(buffer, sizeof(buffer), logfile, getpid()); + snprintf(buffer, sizeof(buffer), "%s-%d", logfile, (int)getpid()); if (buffer[0] == '+') _ppd_debug_fd = open(buffer + 1, O_WRONLY | O_APPEND | O_CREAT, 0644); diff --git a/ppd/imagetops-pstops.c b/ppd/imagetops-pstops.c index 42ff51d3..a1b2fccf 100644 --- a/ppd/imagetops-pstops.c +++ b/ppd/imagetops-pstops.c @@ -1178,6 +1178,9 @@ ppdFilterImageToPS(int inputfd, // I - File descriptor input if (log) log(ld, CF_LOGLEVEL_ERROR, "ppdFilterImageToPS: The print file could not be opened - %s", strerror(errno)); + cfImageClose(img); + fclose(doc.outputfp); + close(outputfd); return (1); } @@ -1589,6 +1592,8 @@ ppdFilterImageToPS(int inputfd, // I - File descriptor input log(ld, CF_LOGLEVEL_ERROR, "ppdFilterImageToPS: Could not allocate memory."); cfImageClose(img); + fclose(doc.outputfp); + close(outputfd); return (2); } diff --git a/ppd/ppd-cache.c b/ppd/ppd-cache.c index 818f5b09..75ad4fad 100644 --- a/ppd/ppd-cache.c +++ b/ppd/ppd-cache.c @@ -752,7 +752,7 @@ ppdCacheCreateWithFile( cupsArrayAdd(pc->prefilters, value); } - else if (!_ppd_strcasecmp(line, "Product")) + else if (!pc->product && !_ppd_strcasecmp(line, "Product")) { pc->product = strdup(value); } diff --git a/ppd/ppd-collection.cxx b/ppd/ppd-collection.cxx index d9f7119c..74854111 100644 --- a/ppd/ppd-collection.cxx +++ b/ppd/ppd-collection.cxx @@ -67,7 +67,7 @@ typedef union // **** TAR record format **** chksum[8], // Octal checksum value linkflag, // File type linkname[100], // Source path for link - magic[6], // Magic string + magic[8], // Magic string version[2], // Format version uname[32], // User name gname[32], // Group name @@ -232,6 +232,7 @@ ppdCollectionListPPDs( ppdlist.PPDsByMakeModel = cupsArrayNew((cups_array_cb_t)compare_ppds, NULL, NULL, 0, NULL, NULL); ppdlist.ChangedPPD = 0; + ppdlist.Inodes = NULL; // @@ -847,9 +848,9 @@ ppdCollectionDumpCache(const char *filename, // I - Filename for (ppd = (ppd_info_t *)cupsArrayGetFirst(ppdlist.PPDsByName); ppd; ppd = (ppd_info_t *)cupsArrayGetNext(ppdlist.PPDsByName)) - printf("%d,%ld,%d,%d,\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\"," + printf("%jd,%ld,%d,%d,\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\"," "\"%s\",\"%s\"\n", - (int)ppd->record.mtime, (long)ppd->record.size, + (intmax_t)ppd->record.mtime, (long)ppd->record.size, ppd->record.model_number, ppd->record.type, ppd->record.filename, ppd->record.name, ppd->record.languages[0], ppd->record.products[0], ppd->record.psversions[0], ppd->record.make, @@ -1273,11 +1274,14 @@ free_ppdlist(ppd_list_t *ppdlist) // I - PPD list to free ppd_info_t *ppd; // Pointer to PPD info - for (dinfoptr = (struct stat *)cupsArrayGetFirst(ppdlist->Inodes); - dinfoptr; - dinfoptr = (struct stat *)cupsArrayGetNext(ppdlist->Inodes)) - free(dinfoptr); - cupsArrayDelete(ppdlist->Inodes); + if (ppdlist->Inodes) + { + for (dinfoptr = (struct stat *)cupsArrayGetFirst(ppdlist->Inodes); + dinfoptr; + dinfoptr = (struct stat *)cupsArrayGetNext(ppdlist->Inodes)) + free(dinfoptr); + cupsArrayDelete(ppdlist->Inodes); + } for (ppd = (ppd_info_t *)cupsArrayGetFirst(ppdlist->PPDsByName); ppd; diff --git a/ppd/ppd-ipp.c b/ppd/ppd-ipp.c index 05a58dc2..b272c9fa 100644 --- a/ppd/ppd-ipp.c +++ b/ppd/ppd-ipp.c @@ -1321,7 +1321,8 @@ ppdLoadAttributes( (ppd_option = ppdFindOption(ppd, "print-rendering-intent")) != NULL) && ppd_option->num_choices > 0) { - for (i = 0; i < ppd_option->num_choices && i < sizeof(items); i ++) + num_items = sizeof(items)/sizeof(char*); + for (i = 0; i < ppd_option->num_choices && i < num_items; i ++) items[i] = ppd_option->choices[i].choice; ippAddStrings(attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD, "print-rendering-intent-supported", i, NULL, items); diff --git a/ppd/ppd-test.c b/ppd/ppd-test.c index 4a99698f..e151d6d2 100644 --- a/ppd/ppd-test.c +++ b/ppd/ppd-test.c @@ -3059,7 +3059,7 @@ check_filters(ppd_file_t *ppd, // I - PPD file type[256], // Type for filter dstsuper[16], // Destination super-type for filter dsttype[256], // Destination type for filter - program[128], // Program/filter name + program[1024], // Program/filter name pathprog[1024]; // Complete path to program/filter int cost; // Cost of filter const char *prefix; // WARN/FAIL prefix diff --git a/ppd/rastertops.c b/ppd/rastertops.c index e1cda804..dc8bac7d 100644 --- a/ppd/rastertops.c +++ b/ppd/rastertops.c @@ -524,7 +524,12 @@ ppdFilterRasterToPS(int inputfd, // I - File descriptor input stream { if (log) log(ld, CF_LOGLEVEL_DEBUG, "ppdFilterRasterToPS: Input is empty, outputting empty file."); + cupsRasterClose(ras); + cupsFileClose(inputfp); + fclose(outputfp); + close(outputfd); + return (0); }