summaryrefslogtreecommitdiff
path: root/src/cups/cups-genppdupdate.in
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@debian.org>2008-10-26 16:15:53 +0000
committerRoger Leigh <rleigh@debian.org>2008-10-26 16:15:53 +0000
commit97aedb05b271e9486f51eac1aee64fce92da64ca (patch)
tree9abd1bee206c4ea14bfebac318846e5fe32c6c67 /src/cups/cups-genppdupdate.in
parent162bb22c0a612c065ea77a88136fcf8ded9159a9 (diff)
Imported Upstream version 4.3.99+cvs20060121.dfsg.1
Diffstat (limited to 'src/cups/cups-genppdupdate.in')
-rw-r--r--src/cups/cups-genppdupdate.in9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/cups/cups-genppdupdate.in b/src/cups/cups-genppdupdate.in
index 94e9085..1b90140 100644
--- a/src/cups/cups-genppdupdate.in
+++ b/src/cups/cups-genppdupdate.in
@@ -1,5 +1,5 @@
#! @PERL@ -w
-# $Id: cups-genppdupdate.in,v 1.21 2005/08/14 10:07:36 rleigh Exp $
+# $Id: cups-genppdupdate.in,v 1.22 2005/12/24 22:41:11 rlk Exp $
# Update CUPS PPDs for Gutenprint queues.
# Copyright (C) 2002-2003 Roger Leigh (rleigh@debian.org)
#
@@ -173,6 +173,7 @@ sub update_ppd ($) {
open ORIG, $_ or die "$_: can't open PPD file: $!";
seek (ORIG, 0, 0) or die "can't seek to start of PPD file";
+ my @orig_metadata = stat(ORIG);
if ($debug) {
print "Source Filename: $ppd_source_filename\n";
}
@@ -277,8 +278,6 @@ sub update_ppd ($) {
# Save new PPD in a temporary file, for processing...
my($tmpfile, $tmpfilename) = tmpnam();
- chown(0, 0, $tmpfilename); # root.root
- chmod(0644, $tmpfilename);
unlink $tmpfilename or warn "can't unlink temporary file $tmpfile: $!\n";
print $tmpfile $source_data;
@@ -366,8 +365,6 @@ default_loop:
warn "Can't open $tmpnew for writing: $!\n";
return 0;
}
- chown(0, 0, $tmpnew); # Bad idea to hardcode this...
- chmod(0644, $tmpnew); # Bad idea to hardcode this...
print NEWPPD $source_data;
if (! close NEWPPD) {
warn "Can't close ${tmpnew}.new for writing: $!\n";
@@ -380,6 +377,8 @@ default_loop:
unlink $tmpnew;
return 0;
}
+ chown($orig_metadata[4], $orig_metadata[5], $ppd_source_filename);
+ chmod(($orig_metadata[2] & 0777), $ppd_source_filename);
if (!$quiet || $verbose) {
print STDOUT "Updated $ppd_source_filename using $source\n";