Bug#506350: patch

2008-11-23 Thread Raphael Geissert
Hi,

Sorry for the delay.

2008/11/21 dann frazier [EMAIL PROTECTED]:
 Thanks for the report. Does this patch look sufficient to you?

 --- flamethrower-0.1.8.orig/bin/flamethrower
 +++ flamethrower-0.1.8/bin/flamethrower
 @@ -9,6 +9,7 @@

  use strict;
  use File::Path;
 +use File::Temp;
  use Getopt::Long;

  use lib /usr/lib/flamethrower;
 @@ -23,7 +24,7 @@
  my $version_number  = INS_VERSION;
  my $conf_file   = '/etc/flamethrower/flamethrower.conf';
  my $transport   = udp-receiver;
 -my $tmp_dir = /tmp/.flamethrower.$$;
 +my $tmp_dir = File::Temp::tempdir(/tmp/flamethrower.XX);

You could even omit the template and let tempdir create a directory
with a random name under $TMPDIR (instead of hard-coding /tmp).

Same as for the other calls. Other than that it does look good.

Cheers,
-- 
Raphael Geissert - Debian Maintainer
www.debian.org - get.debian.net

P. J. O'Rourke  - Never wear anything that panics the cat.



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#506350: patch

2008-11-21 Thread dann frazier
Thanks for the report. Does this patch look sufficient to you?

--- flamethrower-0.1.8.orig/bin/flamethrower
+++ flamethrower-0.1.8/bin/flamethrower
@@ -9,6 +9,7 @@
 
 use strict;
 use File::Path;
+use File::Temp;
 use Getopt::Long;
 
 use lib /usr/lib/flamethrower;
@@ -23,7 +24,7 @@
 my $version_number  = INS_VERSION;
 my $conf_file   = '/etc/flamethrower/flamethrower.conf';
 my $transport   = udp-receiver;
-my $tmp_dir = /tmp/.flamethrower.$$;
+my $tmp_dir = File::Temp::tempdir(/tmp/flamethrower.XX);
 
 
 my $version_info = EOF;
@@ -283,13 +284,16 @@
 #
 my $udp_cmd;
 my $tar_cmd;
+my $tar_fh;
+my $tar_file;
 
+($tar_fh, $tar_file) = File::Temp::tempfile(/tmp/multicast.tar.XX);
 if($verbose) {
-$udp_cmd = udp-receiver $udp_receiver_options --file 
/tmp/multicast.tar.$$;
-$tar_cmd = tar $tar_opts -C $dir -f /tmp/multicast.tar.$$;
+$udp_cmd = udp-receiver $udp_receiver_options --file $tar_file;
+$tar_cmd = tar $tar_opts -C $dir -f $tar_file;
 } else {
-$udp_cmd = udp-receiver $udp_receiver_options --file 
/tmp/multicast.tar.$$ 2/dev/null;
-$tar_cmd = tar $tar_opts -C $dir -f /tmp/multicast.tar.$$;
+$udp_cmd = udp-receiver $udp_receiver_options --file $tar_file 
2/dev/null;
+$tar_cmd = tar $tar_opts -C $dir -f $tar_file;
 }
 
 print $udp_cmd\n if($verbose);
@@ -298,7 +302,8 @@
 print $tar_cmd\n if($verbose);
 !system($tar_cmd) or die(FAILED: $tar_cmd);
 
-unlink(/tmp/multicast.tar.$$);
+close $tar_fh;
+unlink($tar_file);
 }
 
 


-- 
dann frazier




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]