summaryrefslogtreecommitdiffstats
path: root/PC
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-09-01 19:37:43 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-09-01 19:37:43 (GMT)
commita762285831d1591d5c621394f8f6be45688ba33d (patch)
tree5e24a13489617c5f68dede866921bcc92b46e4d1 /PC
parent222b20844f28f37dbe5431eb293ef2b35df71ae7 (diff)
downloadcpython-a762285831d1591d5c621394f8f6be45688ba33d.zip
cpython-a762285831d1591d5c621394f8f6be45688ba33d.tar.gz
cpython-a762285831d1591d5c621394f8f6be45688ba33d.tar.bz2
Issue #12802: the Windows error ERROR_DIRECTORY (numbered 267) is now
mapped to POSIX errno ENOTDIR (previously EINVAL).
Diffstat (limited to 'PC')
-rw-r--r--PC/errmap.h1
-rw-r--r--PC/generrmap.c21
2 files changed, 16 insertions, 6 deletions
diff --git a/PC/errmap.h b/PC/errmap.h
index d225aa4..8dde31c 100644
--- a/PC/errmap.h
+++ b/PC/errmap.h
@@ -72,6 +72,7 @@ int winerror_to_errno(int winerror)
case 202: return 8;
case 206: return 2;
case 215: return 11;
+ case 267: return 20;
case 1816: return 12;
default: return EINVAL;
}
diff --git a/PC/generrmap.c b/PC/generrmap.c
index bf1081b..0323cd4 100644
--- a/PC/generrmap.c
+++ b/PC/generrmap.c
@@ -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");
}