summaryrefslogtreecommitdiffstats
path: root/Modules/dlmodule.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-07-10 01:18:57 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-07-10 01:18:57 (GMT)
commit2a30cd0ef0673710a1a4e188b50c11026c403b2a (patch)
treea95d41411e8f7d39a0fa6b6b73f99fc93573d8ea /Modules/dlmodule.c
parent4a5fbda66d3132af761e32e164ed398977f51694 (diff)
downloadcpython-2a30cd0ef0673710a1a4e188b50c11026c403b2a.zip
cpython-2a30cd0ef0673710a1a4e188b50c11026c403b2a.tar.gz
cpython-2a30cd0ef0673710a1a4e188b50c11026c403b2a.tar.bz2
Patch #1516912: improve Modules support for OpenVMS.
Diffstat (limited to 'Modules/dlmodule.c')
-rw-r--r--Modules/dlmodule.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/Modules/dlmodule.c b/Modules/dlmodule.c
index 899ad86..5622ed9 100644
--- a/Modules/dlmodule.c
+++ b/Modules/dlmodule.c
@@ -5,6 +5,10 @@
#include <dlfcn.h>
+#ifdef __VMS
+#include <unistd.h>
+#endif
+
#ifndef RTLD_LAZY
#define RTLD_LAZY 1
#endif
@@ -186,6 +190,24 @@ dl_open(PyObject *self, PyObject *args)
PyErr_SetString(Dlerror, dlerror());
return NULL;
}
+#ifdef __VMS
+ /* Under OpenVMS dlopen doesn't do any check, just save the name
+ * for later use, so we have to check if the file is readable,
+ * the name can be a logical or a file from SYS$SHARE.
+ */
+ if (access(name, R_OK)) {
+ char fname[strlen(name) + 20];
+ strcpy(fname, "SYS$SHARE:");
+ strcat(fname, name);
+ strcat(fname, ".EXE");
+ if (access(fname, R_OK)) {
+ dlclose(handle);
+ PyErr_SetString(Dlerror,
+ "File not found or protection violation");
+ return NULL;
+ }
+ }
+#endif
return newdlobject(handle);
}