From c21050f20256c4b4160b903260d2d8762e0a6cc0 Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Tue, 13 Feb 2024 16:50:01 +0100 Subject: [PATCH] Cygwin: Don't abort read on EACCES Cygwin uses EACCES as a fallback for unknown errors. --- rescuebook.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rescuebook.cc b/rescuebook.cc index 2d114f4..7186c77 100644 --- a/rescuebook.cc +++ b/rescuebook.cc @@ -135,7 +135,13 @@ int Rescuebook::copy_block( const Block & b, int & copied_size, int & error_size error_size = errno ? b.size() - copied_size : 0; if( copied_size <= 0 ) switch( errno ) { - case EACCES: case EBADF: case EBUSY: case EISDIR: case ENOBUFS: + // Cygwin maps unknown Windows errors to EACCESS. This includes + // ERROR_MEDIA_CHANGED(1110) which may be returned on read errors + // from USB devices. +#ifndef __CYGWIN__ + case EACCES: +#endif + case EBADF: case EBUSY: case EISDIR: case ENOBUFS: case ENODEV: case ENOENT: case ENOMEM: case ENOSYS: case ENXIO: case EPERM: case ESPIPE: final_msg( iname_, "Fatal error reading the input file", errno ); -- 2.43.0