45 lines
1.3 KiB
Diff
45 lines
1.3 KiB
Diff
--- src/cups-pdf.c.orig 2017-02-27 18:59:19.385868066 -0400
|
|
+++ src/cups-pdf.c 2017-02-27 19:03:21.326029747 -0400
|
|
@@ -821,6 +880,7 @@
|
|
gid_t *groups;
|
|
int ngroups;
|
|
pid_t pid;
|
|
+ struct stat statout;
|
|
|
|
if (setuid(0)) {
|
|
(void) fputs("CUPS-PDF cannot be called without root privileges!\n", stderr);
|
|
@@ -1050,7 +1110,11 @@
|
|
|
|
(void) umask(0077);
|
|
size=system(gscall);
|
|
- log_event(CPDEBUG, "ghostscript has finished: %d", size);
|
|
+ if (size)
|
|
+ log_event(CPERROR, "ghostscript reported an error", size);
|
|
+ else
|
|
+ log_event(CPDEBUG, "ghostscript succeeded", NULL);
|
|
+
|
|
if (chmod(outfile, mode))
|
|
log_event(CPERROR, "failed to set file mode for PDF file: %s (non fatal)", outfile);
|
|
else
|
|
@@ -1083,6 +1147,11 @@
|
|
else
|
|
log_event(CPDEBUG, "spoolfile unlinked: %s", spoolfile);
|
|
|
|
+ if (stat(outfile, &statout) || statout.st_size==0)
|
|
+ log_event(CPSTATUS, "PDF creation failed", NULL);
|
|
+ else
|
|
+ log_event(CPSTATUS, "PDF creation successfully finished", outfile);
|
|
+
|
|
free(groups);
|
|
free(dirname);
|
|
free(spoolfile);
|
|
@@ -1091,8 +1160,6 @@
|
|
|
|
log_event(CPDEBUG, "all memory has been freed");
|
|
|
|
- log_event(CPSTATUS, "PDF creation successfully finished for %s", passwd->pw_name);
|
|
-
|
|
if (logfp!=NULL)
|
|
(void) fclose(logfp);
|
|
return 0;
|