Patch #1516912: improve Modules support for OpenVMS.

This commit is contained in:
Neal Norwitz 2006-07-10 01:18:57 +00:00
parent 4a5fbda66d
commit 2a30cd0ef0
9 changed files with 154 additions and 63 deletions

View file

@ -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);
}