From cc464d4acb848cca593a8d3f716e2bfd404b33d1 Mon Sep 17 00:00:00 2001 From: "Howard M. Harte" Date: Sat, 16 Jan 2021 13:40:33 -0800 Subject: [PATCH] AltairZ80: mdfc: Fix unit detach. --- AltairZ80/mfdc.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/AltairZ80/mfdc.c b/AltairZ80/mfdc.c index e3d19c20..98e1cef3 100644 --- a/AltairZ80/mfdc.c +++ b/AltairZ80/mfdc.c @@ -1,9 +1,7 @@ /************************************************************************* * * - * $Id: mfdc.c 1995 2008-07-15 03:59:13Z hharte $ * - * * - * Copyright (c) 2007-2015 Howard M. Harte. * - * hharte@magicandroidapps.com * + * Copyright (c) 2007-2021 Howard M. Harte. * + * https://github.com/hharte * * * * Permission is hereby granted, free of charge, to any person obtaining * * a copy of this software and associated documentation files (the * @@ -37,9 +35,6 @@ * www.hartetechnologies.com/manuals in the Vector Graphic section * * for details of the on-disk sector format and programming information. * * * - * Environment: * - * User mode only * - * * *************************************************************************/ /*#define DBG_MSG */ @@ -308,15 +303,12 @@ static t_stat mfdc_detach(UNIT *uptr) return SCPE_ARG; DBG_PRINT(("Detach MFDC%d\n", i)); - r = diskClose(&mfdc_info->drive[i].imd); - if (r != SCPE_OK) - return r; + if (uptr->u3 == IMAGE_TYPE_IMD) { + diskClose(&mfdc_info->drive[i].imd); + } r = detach_unit(uptr); /* detach unit */ - if (r != SCPE_OK) - return r; - - return SCPE_OK; + return r; }