X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=util%2Ffipsas.pl;h=1694c59a411fc52582574f262c2e902c3606d241;hp=6e10d7d8d5c636fdc103daddb651e3ac94b14538;hb=f953c2d039f81ecbe8dfec86c3c22f204262cd21;hpb=ce02589259c4eecf5479d6d5714d8caee7b5e326 diff --git a/util/fipsas.pl b/util/fipsas.pl index 6e10d7d8d5..1694c59a41 100644 --- a/util/fipsas.pl +++ b/util/fipsas.pl @@ -8,6 +8,9 @@ my @ARGS = @ARGV; my $top = shift @ARGS; my $target = shift @ARGS; +my $tmptarg = $target; + +$tmptarg =~ s/\.[^\\\/\.]+$/.tmp/; my $runasm = 1; @@ -48,12 +51,16 @@ while () my ($from, $to); +#delete any temp file lying around + +unlink $tmptarg; + #rename target temporarily -rename($target, "tmptarg.s") || die "Can't rename $target\n"; +rename($target, $tmptarg) || die "Can't rename $target"; #edit target -open IN,"tmptarg.s"; -open OUT, ">$target"; +open(IN,$tmptarg) || die "Can't open temporary file"; +open(OUT, ">$target") || die "Can't open output file $target"; while () { @@ -75,16 +82,12 @@ if ($runasm) # restore target unlink $target; - rename "tmptarg.s", $target; + rename $tmptarg, $target; die "Error executing assembler!" if $rv != 0; } else { # Don't care about target - unlink "tmptarg.s"; + unlink $tmptarg; } - - - -