[cups-pdf] report success/error in log file #1010434

Remi Collet remi at fedoraproject.org
Mon Sep 23 06:38:02 UTC 2013


commit dde7f8842089e070cb2758329038ff0fcdf698ed
Author: Remi Collet <remi at fedoraproject.org>
Date:   Mon Sep 23 08:37:44 2013 +0200

    report success/error in log file #1010434

 cups-pdf-result.patch |   38 ++++++++++++++++++++++++++++++++++++++
 cups-pdf.spec         |    8 +++++++-
 2 files changed, 45 insertions(+), 1 deletions(-)
---
diff --git a/cups-pdf-result.patch b/cups-pdf-result.patch
new file mode 100644
index 0000000..8f46988
--- /dev/null
+++ b/cups-pdf-result.patch
@@ -0,0 +1,38 @@
+--- src/cups-pdf.c.old	2013-09-23 07:33:41.124582086 +0200
++++ src/cups-pdf.c	2013-09-23 07:45:21.649324590 +0200
+@@ -623,6 +623,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);
+@@ -851,8 +852,12 @@
+      
+     (void) umask(0077);
+     size=system(gscall);
+-    (void) snprintf(title,BUFSIZE,"%d",size);
+-    log_event(CPDEBUG, "ghostscript has finished", title);
++    if (size) {
++      (void) snprintf(title,BUFSIZE,"%d",size);
++      log_event(CPERROR, "ghostscript reported an error", title);
++    } else
++      log_event(CPDEBUG, "ghostscript succeeded", NULL);
++
+     if (chmod(outfile, mode))
+       log_event(CPERROR, "failed to set file mode for PDF file (non fatal)", outfile);
+     else 
+@@ -892,7 +897,11 @@
+   
+   log_event(CPDEBUG, "all memory has been freed", NULL);
+ 
+-  log_event(CPSTATUS, "PDF creation successfully finished", outfile);
++  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(outfile);
+ 
+   if (logfp!=NULL)
diff --git a/cups-pdf.spec b/cups-pdf.spec
index 73b023c..a4edee4 100644
--- a/cups-pdf.spec
+++ b/cups-pdf.spec
@@ -2,7 +2,7 @@ Summary:        Extension for creating pdf-Files with CUPS
 Summary(fr):    Extension de CUPS pour créer des fichiers PDF
 Name:           cups-pdf
 Version:        2.6.1
-Release:        6%{?dist}
+Release:        7%{?dist}
 Group:          Applications/Publishing
 URL:            http://www.cups-pdf.de/
 License:        GPLv2+
@@ -18,6 +18,8 @@ Patch2:         cups-pdf-desktop.patch
 Patch3:         cups-pdf-title.patch
 # Fix build warning
 Patch4:         cups-pdf-build.patch
+# Report error/success in log
+Patch5:         cups-pdf-result.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:  cups-devel
@@ -70,6 +72,7 @@ cp %{SOURCE1} INSTALL.RPM
 %patch2 -p0 -b .desktop
 %patch3 -p0 -b .title
 %patch4 -p0 -b .build
+%patch5 -p0 -b .result
 
 
 %build
@@ -132,6 +135,9 @@ fi
 
 
 %changelog
+* Mon Sep 23 2013 Remi Collet <remi at fedoraproject.org> 2.6.1-7
+- report success/error in log file #1010434
+
 * Thu Sep 12 2013 Remi Collet <remi at fedoraproject.org> 2.6.1-6
 - log path of generated PDF #1007143
 


More information about the scm-commits mailing list