1
0
mirror of https://github.com/simh/simh.git synced 2026-04-27 20:38:04 +00:00

TAPE: Fix potential crash in library unit tests

Improper declaration of state variables referenced in setjmp/longjmp.
This commit is contained in:
Larry Baker
2020-08-15 16:21:02 -07:00
committed by Mark Pizzolato
parent 272bbd4551
commit 4041894b67
3 changed files with 16 additions and 7 deletions

View File

@@ -3894,6 +3894,10 @@ sim_switches = SWMASK ('F') | (sim_switches & SWMASK ('D')) | SWMASK ('N');
if (sim_switches & SWMASK ('D'))
uptr->dctrl = MTSE_DBG_STR | MTSE_DBG_DAT;
aws_stat = sim_tape_attach_ex (uptr, name, (saved_switches & SWMASK ('D')) ? MTSE_DBG_STR | MTSE_DBG_DAT: 0, 0);
if (aws_stat != MTSE_OK) {
stat = aws_stat;
goto Done_Files;
}
sim_switches = saved_switches;
stat = SCPE_OK;
for (i=0; i<files; i++) {
@@ -4025,7 +4029,8 @@ if (fTAR)
if (fTAR2)
fclose (fTAR2);
free (buf);
sim_tape_detach (uptr);
if (aws_stat == MTSE_OK)
sim_tape_detach (uptr);
if (stat == SCPE_OK) {
char name1[CBUFSIZE], name2[CBUFSIZE];
@@ -4137,6 +4142,10 @@ t_stat sim_tape_test (DEVICE *dptr)
int32 saved_switches = sim_switches;
SIM_TEST_INIT;
if (dptr->units->flags & UNIT_ATT)
return sim_messagef (SCPE_ALATT, "The %s device must be detached to run the tests\n",
sim_uname(dptr->units));
sim_printf ("\nTesting %s device sim_tape APIs\n", sim_uname(dptr->units));
SIM_TEST(sim_tape_test_density_string ());