DISK: Fix auto detect format attach logic for non VHD disks #356

This commit is contained in:
Mark Pizzolato 2016-11-25 16:25:43 -08:00
parent 1ec46fbe11
commit 4f1f439174

View file

@ -1040,7 +1040,7 @@ else
switch (DK_GET_FMT (uptr)) { /* case on format */ switch (DK_GET_FMT (uptr)) { /* case on format */
case DKUF_F_STD: /* SIMH format */ case DKUF_F_STD: /* SIMH format */
if (NULL == (uptr->fileref = sim_vhd_disk_open (cptr, "rb"))) { 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; return SCPE_OPENERR;
open_function = sim_fopen; open_function = sim_fopen;
size_function = sim_fsize_ex; size_function = sim_fsize_ex;
@ -2906,7 +2906,7 @@ if ((sDynamic) &&
if (0 == stat (CheckPath, &statb)) { if (0 == stat (CheckPath, &statb)) {
sim_printf ("Parent VHD '%s' corrupt for Differencing VHD: %s\n", CheckPath, szVHDPath); sim_printf ("Parent VHD '%s' corrupt for Differencing VHD: %s\n", CheckPath, szVHDPath);
Return = EINVAL; /* File Corrupt/Invalid */ Return = EBADF; /* File Corrupt/Invalid */
break; break;
} }
} }
@ -2914,7 +2914,7 @@ if ((sDynamic) &&
if (!*szParentVHDPath) { if (!*szParentVHDPath) {
if (Return != EINVAL) /* File Not Corrupt? */ if (Return != EINVAL) /* File Not Corrupt? */
sim_printf ("Missing Parent VHD for Differencing VHD: %s\n", szVHDPath); sim_printf ("Missing Parent VHD for Differencing VHD: %s\n", szVHDPath);
Return = EINVAL; Return = EBADF;
} }
} }
} }