summaryrefslogtreecommitdiffstats
path: root/Modules/dlmodule.c
diff options
context:
space:
mode:
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);
}