mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
mapped to POSIX errno ENOTDIR (previously EINVAL).
This commit is contained in:
parent
222b20844f
commit
a762285831
4 changed files with 27 additions and 6 deletions
|
|
@ -1,3 +1,6 @@
|
|||
#include <windows.h>
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
|
@ -6,15 +9,21 @@
|
|||
int main()
|
||||
{
|
||||
int i;
|
||||
_setmode(fileno(stdout), O_BINARY);
|
||||
printf("/* Generated file. Do not edit. */\n");
|
||||
printf("int winerror_to_errno(int winerror)\n");
|
||||
printf("{\n\tswitch(winerror) {\n");
|
||||
printf("{\n switch(winerror) {\n");
|
||||
for(i=1; i < 65000; i++) {
|
||||
_dosmaperr(i);
|
||||
if (errno == EINVAL)
|
||||
continue;
|
||||
printf("\t\tcase %d: return %d;\n", i, errno);
|
||||
if (errno == EINVAL) {
|
||||
/* Issue #12802 */
|
||||
if (i == ERROR_DIRECTORY)
|
||||
errno = ENOTDIR;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
printf(" case %d: return %d;\n", i, errno);
|
||||
}
|
||||
printf("\t\tdefault: return EINVAL;\n");
|
||||
printf("\t}\n}\n");
|
||||
printf(" default: return EINVAL;\n");
|
||||
printf(" }\n}\n");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue