From 749dff992a915224e50ac56065a664380632ed52 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 11 Sep 2018 16:29:25 -0600 Subject: [PATCH] windows: handle ERROR_NOT_READY The windows-to-posix error translation doesn't include ERROR_NOT_READY, add that. Also add a default case that catches if we don't know what an error is, and return EIO. That seems much safer than just returning the Windows error directly, since the caller expects an errno. Signed-off-by: Jens Axboe --- os/windows/posix.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/os/windows/posix.c b/os/windows/posix.c index d33250de..3285ce58 100644 --- a/os/windows/posix.c +++ b/os/windows/posix.c @@ -55,6 +55,7 @@ int win_to_posix_error(DWORD winerr) case ERROR_NOT_SAME_DEVICE: return EXDEV; case ERROR_WRITE_PROTECT: return EROFS; case ERROR_BAD_UNIT: return ENODEV; + case ERROR_NOT_READY: return EAGAIN; case ERROR_SHARING_VIOLATION: return EACCES; case ERROR_LOCK_VIOLATION: return EACCES; case ERROR_SHARING_BUFFER_EXCEEDED: return ENOLCK; @@ -110,6 +111,9 @@ int win_to_posix_error(DWORD winerr) case ERROR_DISK_FULL: return ENOSPC; case ERROR_NOACCESS: return EFAULT; case ERROR_FILE_INVALID: return ENXIO; + default: + log_err("fio: windows error %d not handled\n", winerr); + return EIO; } return winerr; -- 2.25.1