Debian Codegraph @

debian/patches/no-posix-tmpnam-call

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