[Po4a-commits] "po-debconf podebconf-report-po,1.57,1.58"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Tue May 20 20:38:45 UTC 2008


Update of /cvsroot/po4a/po-debconf
In directory alioth:/tmp/cvs-serv20153

Modified Files:
	podebconf-report-po 
Log Message:
Create the temporary file with File::Temp::tempfile() instead of tmpnam(). This permits to honor the TMP or TMPDIR environment variables. Closes: #482097


Index: podebconf-report-po
===================================================================
RCS file: /cvsroot/po4a/po-debconf/podebconf-report-po,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- podebconf-report-po	9 May 2008 23:59:13 -0000	1.57
+++ podebconf-report-po	20 May 2008 20:38:40 -0000	1.58
@@ -41,6 +41,7 @@
 use MIME::QuotedPrint;
 use Getopt::Long;
 use POSIX;
+use File::Temp 'tempfile';
 use Cwd 'abs_path';
 
 ## Global variables
@@ -949,12 +950,12 @@
 	my $editor = shift;
 	my $body = shift;
 	my $opts = "";
-	my $tmpnam = tmpnam();
+	my ($fh, $tmpnam) = tempfile("podebconf-report-po.mail.tmp.XXXXXX",
+	                             UNLINK => 0,
+	                             TMPDIR => 1);
 
-	open (OUT, "> $tmpnam")
-		or die ("Couldn't write $tmpnam: $!\nExiting!\n");
-	print OUT $body;
-	close(OUT)
+	print $fh $body;
+	close($fh)
 		or die ("Couldn't close $tmpnam: $!\nExiting!\n");
 
 	$opts = "-f" if ($editor eq "vim");




More information about the Po4a-commits mailing list