diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-07-10 01:18:57 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-07-10 01:18:57 (GMT) |
commit | 2a30cd0ef0673710a1a4e188b50c11026c403b2a (patch) | |
tree | a95d41411e8f7d39a0fa6b6b73f99fc93573d8ea /Modules/dlmodule.c | |
parent | 4a5fbda66d3132af761e32e164ed398977f51694 (diff) | |
download | cpython-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.c | 22 |
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); } |