SCP: Always clear uptr->fileref on detach
This commit is contained in:
parent
83234f1e9d
commit
b1318f5c37
1 changed files with 7 additions and 2 deletions
7
scp.c
7
scp.c
|
@ -6765,8 +6765,13 @@ if ((uptr->flags & UNIT_BUF) && (uptr->filebuf)) {
|
||||||
uptr->flags = uptr->flags & ~(UNIT_ATT | ((uptr->flags & UNIT_ROABLE) ? UNIT_RO : 0));
|
uptr->flags = uptr->flags & ~(UNIT_ATT | ((uptr->flags & UNIT_ROABLE) ? UNIT_RO : 0));
|
||||||
free (uptr->filename);
|
free (uptr->filename);
|
||||||
uptr->filename = NULL;
|
uptr->filename = NULL;
|
||||||
if (fclose (uptr->fileref) == EOF)
|
if (uptr->fileref) { /* Only close open file */
|
||||||
|
if (fclose (uptr->fileref) == EOF) {
|
||||||
|
uptr->fileref = NULL;
|
||||||
return SCPE_IOERR;
|
return SCPE_IOERR;
|
||||||
|
}
|
||||||
|
uptr->fileref = NULL;
|
||||||
|
}
|
||||||
return SCPE_OK;
|
return SCPE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue