summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/compiler/aslcompile.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c
index 4932abd88..3d5a1a552 100644
--- a/source/compiler/aslcompile.c
+++ b/source/compiler/aslcompile.c
@@ -1038,7 +1038,19 @@ CmCleanupAndExit (
/* Close all open files */
- Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .i file is same as source file */
+ /*
+ * Take care with the preprocessor file (.i), it might be the same
+ * as the "input" file, depending on where the compiler has terminated
+ * or aborted. Prevent attempt to close the same file twice in
+ * loop below.
+ */
+ if (Gbl_Files[ASL_FILE_PREPROCESSOR].Handle ==
+ Gbl_Files[ASL_FILE_INPUT].Handle)
+ {
+ Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL;
+ }
+
+ /* Close the standard I/O files */
for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++)
{