mirror of
https://github.com/python/cpython.git
synced 2025-09-14 20:56:06 +00:00
Patch #1516912: improve Modules support for OpenVMS.
This commit is contained in:
parent
4a5fbda66d
commit
2a30cd0ef0
9 changed files with 154 additions and 63 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue