diff options
| author | Javier <dev.git@javispedro.com> | 2026-11-01 03:33:01 +0100 |
|---|---|---|
| committer | Javier <dev.git@javispedro.com> | 2026-11-01 03:33:01 +0100 |
| commit | bd13e615c3d2a4bdb10742e9b1a6d140233e63cf (patch) | |
| tree | 13fbc6fc1ce1ff169e099b20c391c97b22ca2621 /dos | |
| parent | a1a872718c1931b9931488a3872d5a0a698aa2c1 (diff) | |
| download | chu-bd13e615c3d2a4bdb10742e9b1a6d140233e63cf.tar.gz chu-bd13e615c3d2a4bdb10742e9b1a6d140233e63cf.zip | |
handle additional errors
Diffstat (limited to 'dos')
| -rw-r--r-- | dos/chud.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -98,9 +98,8 @@ static int ioctl_read_abs_sector(uint8_t drive, void *buffer, uint32_t sector, i regs.h.cl = CHUDISK_IOCTL_DISK_READ_ABS_SECTOR; regs.x.dx = FP_OFF(&ciod); - if (intdos(®s, ®s) == 0) { - return 0; - } else { + intdos(®s, ®s); + if (regs.x.cflag) { struct DOSERROR err; // Get the extended error from DOS, more useful than a simple EACCES // and translate to watcom's errno @@ -118,13 +117,19 @@ static int ioctl_read_abs_sector(uint8_t drive, void *buffer, uint32_t sector, i case DOS_ERROR_READ_FAULT: case DOS_ERROR_WRITE_FAULT: case DOS_ERROR_GEN_FAILURE: + case DOS_ERROR_CRC: errno = EIO; break; + case DOS_ERROR_NOT_ENOUGH_MEMORY: + errno = ENOMEM; + break; default: errno = EFAULT; break; } return -errno; + } else { + return 0; // No error } } |
