Missed one instance of hardcode tempfile.

Cheers,

--Seb
--- ../audiolink-0.05.bak/code/audiolink	2008-09-03 14:53:29.000000000 -0700
+++ code/audiolink	2008-09-03 15:18:10.000000000 -0700
@@ -28,6 +28,7 @@
 use DBI;
 use Getopt::Long;
 use Pod::Usage;
+use File::Temp qw/ tempfile /;
 
 # Options for the database
 $user = undef;
@@ -174,15 +175,15 @@
 
 print "\nCreating the AudioLink database..." if $verbose;
 
-$ret = system("mysqladmin -u$user -p$password -h$host create  $db_name 2>/tmp/audiolink.db.tmp");
+my ($tmpFh, $tmpFile) = tempfile("audiolink.db.tmpXXXXXXXXX", UNLINK => 1);
+$ret = system("mysqladmin -u$user -p$password -h$host create  $db_name 2> $tmpFile");
 
 #    or print "\nSome error occured.
 # If the error reported that the database already exists, it's okay. You already had the database created.
 # If it was some other error, consult the mysqladmin man page and/or notify the AudioLink developers.\n
 # Anyways, continuing to create AudioLink tables.\n";
 
-open (DBOP, "/tmp/audiolink.db.tmp");
-while (<DBOP>) {
+while (<$tmpFh>) {
     if ( /database exists/i) {
 	print "The database already exists.\n" if $verbose;
     } else {
@@ -191,18 +192,14 @@
     }
 }
 
-close DBOP;
-
 print "\nCreating the AudioLink tables..." if $verbose;
 
-$ret = system ("mysql -u$user -p$password -h$host $db_name < /usr/share/doc/audiolink/mysql.schema 2>/tmp/audiolink.tb.tmp");
+$ret = system ("mysql -u$user -p$password -h$host $db_name < /usr/share/doc/audiolink/mysql.schema 2> $tmpFile");
 #    or print "\nSome error occured.
 # If the error reported that the table already exists, it's okay. You already had the table created.
 # If it was some other error, consult the mysql man page and/or notify the AudioLink developers.\n";
 
-open (DBOP, "/tmp/audiolink.tb.tmp");
-
-while (<DBOP>) {
+while (<$tmpFh>) {
     if ( /already exists/i) {
 	print "The table already exists.\n" if $verbose;
     } else {

Reply via email to