Sorry, I sent the wrong patch. Here's the correct one.
-- Martin Michlmayr http://www.cyrius.com/
Index: slugimage =================================================================== --- slugimage (revision 114) +++ slugimage (working copy) @@ -40,7 +40,7 @@ use warnings; use Getopt::Long qw(:config no_ignore_case); -use POSIX qw(tmpnam); +use File::Temp qw(tempfile); my($debug) = 0; my($quiet) = 0; @@ -1005,34 +1005,34 @@ # don't touch RedBoot and SysConf anyway. If no Trailer is specified, # put in one. if (not defined $redboot and not -e "RedBoot") { - $redboot = tmpnam(); - open TMP, ">$redboot" or die "Cannot open file $redboot: $!"; + my $tmp; + ($tmp, $redboot) = tempfile(); push @cleanup, $redboot; # The RedBoot partition is 256 * 1024 = 262144; the trailer we add # is 70 bytes. - print TMP "\0"x(262144-70); + print $tmp "\0"x(262144-70); # Upgrade tools check for an appropriate Sercomm trailer. for my $i (@sercomm_redboot_trailer) { - print TMP pack "S", $i; + print $tmp pack "S", $i; } - close TMP; + close $tmp; } if (not defined $sysconf and not -e "SysConf") { - $sysconf = tmpnam(); - open TMP, ">$sysconf" or die "Cannot open file $sysconf: $!"; + my $tmp; + ($tmp, $sysconf) = tempfile(); push @cleanup, $sysconf; # The SysConf partition is 128 * 1024 = 131072 - print TMP "\0"x131072; - close TMP; + print $tmp "\0"x131072; + close $tmp; } if (not defined $trailer and not -e "Trailer") { - $trailer = tmpnam(); - open TMP, ">$trailer" or die "Cannot open file $trailer: $!"; + my $tmp; + ($tmp, $trailer) = tempfile(); push @cleanup, $trailer; for my $i (@sercomm_flash_trailer) { - print TMP pack "S", $i; + print $tmp pack "S", $i; } - close TMP; + close $tmp; } # If the microcode was not specified, then don't complain that it's missing.