Message348768
Special casing of Winsock error codes should be handled in winerror_to_errno rather than in oserror_parse_args, so it's consistently applied everywhere. And it should use the proper range for Winsock, 10000-11999 -- not 10000-2147483647. Codes above the Winsock range should map to EINVAL. It's not a non-issue since this range has the following blocks allocated:
IPSEC 13000-13999
SXS 14000-14999
EVT 15000-15079
EC 15080-15099
MUI 15100-15199
MCA 15200-15249
SYSPART 15250-15299
VORTEX 15300-15320
GPIO 15321-15340
RUNLEVEL 15400-15500
COMTASK 15501-15510
APPX 15600-15699
APPMODEL 15700-15720
APPXSTATE 15800-15840
API 15841-15860
STORE 15861-15880
Another thing winerror_to_errno should do is unwrap HRESULT codes for Win32 errors (0x80070000-0x8007FFFF). In other words, 0x80070005 is effectively the same as ERROR_ACCESS_DENIED (5). It should be mapped to EACCES and raise PermissionError.
For example:
int
winerror_to_errno(int winerror)
{
/* Unwrap FACILITY_WIN32 HRESULT errors. */
if ((winerror & 0xFFFF0000) == 0x80070000) {
winerror &= 0x0000FFFF;
}
/* Winsock error codes (10000-11999) are errno values. */
if (winerror >= 10000 && winerror < 12000) {
return winerror;
}
switch(winerror) {
/* ... */
}
} |
|
Date |
User |
Action |
Args |
2019-07-30 18:35:10 | eryksun | set | recipients:
+ eryksun, paul.moore, tim.golden, zach.ware, steve.dower |
2019-07-30 18:35:10 | eryksun | set | messageid: <1564511710.04.0.447667243947.issue37705@roundup.psfhosted.org> |
2019-07-30 18:35:10 | eryksun | link | issue37705 messages |
2019-07-30 18:35:09 | eryksun | create | |
|