[X2Go-Commits] [cups-x2go] 06/07: cups-x2go: unlink PS temporary file on-demand in END block.
git-admin at x2go.org
git-admin at x2go.org
Wed Jun 17 20:15:23 CEST 2015
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository cups-x2go.
commit 715dce02a361c9f12af10af5858789cfdcfafdae
Author: Mihai Moldovan <ionic at ionic.de>
Date: Wed Jun 17 19:54:48 2015 +0200
cups-x2go: unlink PS temporary file on-demand in END block.
Also move closelog to END block, because we want to print diagnosis
messages in the END block.
---
cups-x2go | 14 +++++++++++---
debian/changelog | 3 +++
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/cups-x2go b/cups-x2go
index ff0cee5..2b8e492 100755
--- a/cups-x2go
+++ b/cups-x2go
@@ -202,9 +202,11 @@ my $template = "$jid-$uid-cupsjob$$";
my $ps_template = $template . "X" x 16;
my $pdf_template = $template . ".pdf" . "X" x 16;
my $title_template = $template . ".pdf.title" . "X" x 16;
+my $need_ps_file_cleanup = 0;
if (!$psFile)
{
- my ($tfh, $tempFile) = tempfile ($ps_template, TMPDIR => 1);
+ $need_ps_file_cleanup = 1;
+ my ($tfh, $tempFile) = tempfile ($ps_template, UNLINK => 0, TMPDIR => 1);
syslog('info', "Print job comes from STDIN, writing incoming job to temp file $tempFile\n");
binmode ($tfh, ":raw");
@@ -333,5 +335,11 @@ for(my $i=0; $i<scalar(@sessions);$i++ )
unlink ($pdfFile);
unlink ($titleFile);
-# closing syslog
-closelog;
+END {
+ if ($need_ps_file_cleanup) {
+ unlink $psFile or syslog ('warning', "WARNING: cups-x2go: unable to delete temporary postscript file $psFile\n");
+ }
+
+ # closing syslog
+ closelog;
+}
diff --git a/debian/changelog b/debian/changelog
index 52caaa7..3f307fb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,6 +20,9 @@ cups-x2go (3.0.1.3-0x2go1) UNRELEASED; urgency=low
everything at once. Handles large print jobs gracefully.
- cups-x2go: add parentheses to close() calls.
- cups-x2go: delete PDF and title temporary files automatically.
+ - cups-x2go: unlink PS temporary file on-demand in END block. Also move
+ closelog to END block, because we want to print diagnosis messages in
+ the END block.
* debian/control:
- Add dependencies on perl-modules for core modules and ${perl:Depends}
for perl itself.
--
Alioth's /srv/git/code.x2go.org/cups-x2go.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/cups-x2go.git
More information about the x2go-commits
mailing list