windows: make win_to_posix_error() more resilient
authorJens Axboe <axboe@kernel.dk>
Wed, 12 Sep 2018 14:50:16 +0000 (08:50 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 12 Sep 2018 14:50:16 +0000 (08:50 -0600)
If we pass in ERROR_SUCCESS, we should get a zero back.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
os/windows/posix.c

index 5b72beabe1e28b52e3c78623beb7d61dcae6a28c..fd1d5582f1b33c73b84c21f4fffec4c8aafd79b9 100644 (file)
@@ -35,6 +35,8 @@ HRESULT WINAPI StringCchPrintfA(char *pszDest, size_t cchDest, const char *pszFo
 int win_to_posix_error(DWORD winerr)
 {
        switch (winerr) {
+       case ERROR_SUCCESS:
+               return 0;
        case ERROR_FILE_NOT_FOUND:
                return ENOENT;
        case ERROR_PATH_NOT_FOUND: