summaryrefslogtreecommitdiff
path: root/source/compiler/aslcompile.c
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2013-05-29 13:12:00 -0700
committerRobert Moore <Robert.Moore@intel.com>2013-05-29 13:12:00 -0700
commit6ed94cefc65fdd9fe538c77fb3b7d9424aecbe9f (patch)
tree17222f72ae1d9693412f0e0f34d875a76516a311 /source/compiler/aslcompile.c
parent0ac19a10da7c8451b874f58e96a34d77c7622f18 (diff)
downloadacpica-6ed94cefc65fdd9fe538c77fb3b7d9424aecbe9f.tar.gz
iASL: Fix mysterious "could not delete file" errors.
This fix ensures that the intermediate preprocessor .i file is closed before an attempt is made to delete it. This has to be done with care, because it may be the same as the global input file, depending where/when the compiler terminated/aborted.
Diffstat (limited to 'source/compiler/aslcompile.c')
-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++)
{