Displaying 2 results from an estimated 2 matches for "translate_from_errno".
2020 Aug 17
3
[nbdkit] Windows errno handling
...ch reads the last error and translates WSA* to E* codes. This
would solve (1) and is not very invasive for existing code.
We'd have to then need to wrap all assignments to errno
in a macro like:
#ifndef WIN32
#define set_errno(v) (errno = (v))
#else
#define set_errno(v) (WSASetLastError (translate_from_errno (v)))
#endif
This is very invasive for existing code. There are ~60 places in the
existing code which seem to assign to errno, but some of these either
set errno = 0 or are preserving errno (item (3) above), and so we'd
probably want to handle those a bit differently.
Printing of Winsock co...
2020 Aug 17
0
Re: [nbdkit] Windows errno handling
...o E* codes. This
> would solve (1) and is not very invasive for existing code.
>
> We'd have to then need to wrap all assignments to errno
> in a macro like:
>
> #ifndef WIN32
> #define set_errno(v) (errno = (v))
> #else
> #define set_errno(v) (WSASetLastError (translate_from_errno (v)))
> #endif
>
> This is very invasive for existing code. There are ~60 places in the
> existing code which seem to assign to errno, but some of these either
> set errno = 0 or are preserving errno (item (3) above), and so we'd
> probably want to handle those a bit differ...