1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-12-01 00:49:46 +00:00

Use vm_di_get for file streams to close them

This commit is contained in:
Peter Evans 2018-03-07 20:54:46 -06:00
parent f555196080
commit 14123882c2

View File

@ -62,12 +62,15 @@ init(int argc, char **argv)
static void static void
finish() finish()
{ {
// Close any file sources we had opened FILE *stream[3];
for (int i = 1; i <= OPTION_MAX_DISKS; i++) {
FILE *stream = option_get_input(i);
if (stream != NULL) { stream[0] = (FILE *)vm_di_get(VM_DISK1);
fclose(stream); stream[1] = (FILE *)vm_di_get(VM_DISK2);
stream[2] = (FILE *)vm_di_get(VM_DISASM_LOG);
for (int i = 0; i < 3; i++) {
if (stream[i]) {
fclose(stream[i]);
} }
} }