]> granicus.if.org Git - yasm/commitdiff
Delete the output file on error.
authorPeter Johnson <peter@tortall.net>
Fri, 2 Jan 2004 23:57:15 +0000 (23:57 -0000)
committerPeter Johnson <peter@tortall.net>
Fri, 2 Jan 2004 23:57:15 +0000 (23:57 -0000)
Bugzilla bug #23

svn path=/trunk/yasm/; revision=1092

modules/preprocs/nasm/macros.pl

index bb217e15697543996c0b66051720a7af38016e92..9f0a30f024d0f5a886560fa131422d2a73f0cb5c 100644 (file)
@@ -22,7 +22,11 @@ print OUTPUT "/* This file auto-generated from standard.mac by macros.pl" .
 " - don't edit it */\n\n#include <stddef.h>\n\nstatic const char *stdmac[] = {\n";
     
 foreach $fname ( @ARGV ) {
-    open(INPUT,$fname) or die "unable to open $fname\n";
+    if (not open(INPUT,$fname)) {
+       close(OUTPUT);
+       unlink("nasm-macros.c");
+       die "unable to open $fname\n";
+    }
     while (<INPUT>) {
        $line++;
        chomp;
@@ -37,6 +41,8 @@ foreach $fname ( @ARGV ) {
                $index++;
            } 
        } else {
+           close(OUTPUT);
+           unlink("nasm-macros.c");
            die "$fname:$line:  error unterminated quote";
        }
     }