From 97aedb05b271e9486f51eac1aee64fce92da64ca Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Sun, 26 Oct 2008 16:15:53 +0000 Subject: Imported Upstream version 4.3.99+cvs20060121.dfsg.1 --- src/cups/cups-genppdupdate.in | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/cups/cups-genppdupdate.in') 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"; -- cgit v1.2.3