From 4f1f4391740ae5abe15e83e4b4c15270bb5a37a3 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Fri, 25 Nov 2016 16:25:43 -0800 Subject: [PATCH] DISK: Fix auto detect format attach logic for non VHD disks #356 --- sim_disk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sim_disk.c b/sim_disk.c index 3f1b43c3..16c9eac9 100644 --- a/sim_disk.c +++ b/sim_disk.c @@ -1040,7 +1040,7 @@ else switch (DK_GET_FMT (uptr)) { /* case on format */ case DKUF_F_STD: /* SIMH format */ if (NULL == (uptr->fileref = sim_vhd_disk_open (cptr, "rb"))) { - if (errno == EINVAL) /* VHD but broken */ + if (errno == EBADF) /* VHD but broken */ return SCPE_OPENERR; open_function = sim_fopen; size_function = sim_fsize_ex; @@ -2906,7 +2906,7 @@ if ((sDynamic) && if (0 == stat (CheckPath, &statb)) { sim_printf ("Parent VHD '%s' corrupt for Differencing VHD: %s\n", CheckPath, szVHDPath); - Return = EINVAL; /* File Corrupt/Invalid */ + Return = EBADF; /* File Corrupt/Invalid */ break; } } @@ -2914,7 +2914,7 @@ if ((sDynamic) && if (!*szParentVHDPath) { if (Return != EINVAL) /* File Not Corrupt? */ sim_printf ("Missing Parent VHD for Differencing VHD: %s\n", szVHDPath); - Return = EINVAL; + Return = EBADF; } } }