4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-22 23:17:28 +08:00

Cygwin: Map ERROR_NO_SUCH_DEVICE and ERROR_MEDIA_CHANGED to ENODEV

If a removable (USB) device is disconnected after opening its raw
device, R/W attempts fail with ERROR_NO_SUCH_DEVICE(433).  If the
raw device of a partition is used, ERROR_MEDIA_CHANGED(1110) is
returned instead.  Both are mapped to ENODEV(19) because <errno.h>
does not offer a value which better matches ERROR_MEDIA_CHANGED.

Signed-off-by: Christian Franke <christian.franke@t-online.de>
This commit is contained in:
Christian Franke 2024-02-23 19:01:09 +01:00 committed by Corinna Vinschen
parent 388da83dce
commit 4af5f9d51e

View File

@ -438,7 +438,7 @@ static const int errmap[] =
0, /* 430 */
0, /* 431 */
0, /* 432 */
0, /* 433 */
ENODEV, /* ERROR_NO_SUCH_DEVICE */
0, /* 434 */
0, /* 435 */
0, /* 436 */
@ -1115,7 +1115,7 @@ static const int errmap[] =
0, /* ERROR_DEVICE_NOT_PARTITIONED */
0, /* ERROR_UNABLE_TO_LOCK_MEDIA */
0, /* ERROR_UNABLE_TO_UNLOAD_MEDIA */
0, /* ERROR_MEDIA_CHANGED */
ENODEV, /* ERROR_MEDIA_CHANGED */
EIO, /* ERROR_BUS_RESET */
ENOMEDIUM, /* ERROR_NO_MEDIA_IN_DRIVE */
0, /* ERROR_NO_UNICODE_TRANSLATION */