1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
Description: Remove call to deprecated POSIX::tmpnam
This patch replaces the call to POSIX::tmpnam with a call to File::Temp. This call is deprecated and will break with perl 26.
.
File::Temp object handles file cleanup when the object is destroyed, so the call to unlink($filename) is no longer needed.
.
While I was at it, I've replaced a call to POSIX::_exit with good old die, so frozen-bubble no longer depends on POSIX.
Bug-Debian: https://bugs.debian.org/866321
Forwarded: https://github.com/kthakore/frozen-bubble/pull/66
Author: dod
--- a/bin/frozen-bubble
+++ b/bin/frozen-bubble
@@ -51,11 +51,11 @@
use Getopt::Long;
use Data::Dumper;
use Locale::Maketext::Simple;
-use POSIX();
use Math::Trig;
use IO::File;
use Time::HiRes qw(gettimeofday);
use Compress::Bzip2;
+use File::Temp;
use SDL;
use SDL::Rect;
@@ -3718,8 +3718,7 @@
return [ { host => 'localhost', port => 1511 } ];
} else {
unless (exec $fb_server, '-L', '-d', '-n', substr("lan-$mynick", 0, 12), '-z') {
- print STDERR "Could not create server limited to lan game: $!\n";
- POSIX::_exit(1);
+ die "Could not create server limited to lan game: $!\n";
}
}
}
@@ -6020,9 +6019,8 @@
$replayfile = Games::FrozenBubble::Net::http_download($replayfile);
$replayfile or return;
if ($filename =~ /\.bz2$/) {
- my $fh;
- do { $filename = POSIX::tmpnam() }
- until $fh = IO::File->new($filename, O_WRONLY|O_CREAT|O_EXCL);
+ my $fh = File::Temp->new();
+ $filename = $fh->filename;
print $fh $replayfile;
$fh->close;
local *F;
@@ -6036,7 +6034,6 @@
while($bz->bzreadline($line) > 0){ $replayfile .= $line; }
$bz->bzclose();
- unlink ($filename);
}
} else {
if ($replayfile =~ /\.bz2$/) {
|