summaryrefslogtreecommitdiffstats
path: root/Modules/main.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2004-08-19 11:07:49 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2004-08-19 11:07:49 (GMT)
commit4d4dfb7a2b3bf4ed49a9f72ae8b802280b4e6154 (patch)
treef563f7432d818929911fa5e02d61837e294fcb91 /Modules/main.c
parent26b3ebb515eacb997885ff4fe1b425674429e253 (diff)
downloadcpython-4d4dfb7a2b3bf4ed49a9f72ae8b802280b4e6154.zip
cpython-4d4dfb7a2b3bf4ed49a9f72ae8b802280b4e6154.tar.gz
cpython-4d4dfb7a2b3bf4ed49a9f72ae8b802280b4e6154.tar.bz2
Patch #1011822: Display errno/strerror for inaccessible files.
Diffstat (limited to 'Modules/main.c')
-rw-r--r--Modules/main.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/Modules/main.c b/Modules/main.c
index fc5773c..bc543a4 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -302,8 +302,13 @@ Py_Main(int argc, char **argv)
#endif
if (filename != NULL) {
if ((fp = fopen(filename, "r")) == NULL) {
- fprintf(stderr, "%s: can't open file '%s'\n",
- argv[0], filename);
+#ifdef HAVE_STRERROR
+ fprintf(stderr, "%s: can't open file '%s': [Errno %d] %s\n",
+ argv[0], filename, errno, strerror(errno));
+#else
+ fprintf(stderr, "%s: can't open file '%s': Errno %d\n",
+ argv[0], filename, errno);
+#endif
return 2;
}
else if (skipfirstline) {