summaryrefslogtreecommitdiff
path: root/Python/dynload_shlib.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-11-12 14:35:46 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2016-11-12 14:35:46 +0200
commitb51bd875193c84e51afb907a0c8ff6091fc95d5f (patch)
treed2e3c85d92f1ae680f0c90b4b4fc88cce58ecba0 /Python/dynload_shlib.c
parente7ed9c7bd2204dd48d67eb7b14813c0338a85a0c (diff)
parentf246749b9aa9cdb1f05eca29b7eef6a04e05fc8b (diff)
downloadcpython-b51bd875193c84e51afb907a0c8ff6091fc95d5f.tar.gz
Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X
when decode astral characters.
Diffstat (limited to 'Python/dynload_shlib.c')
-rw-r--r--Python/dynload_shlib.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c
index 5cd1efdf76..7f8f134d60 100644
--- a/Python/dynload_shlib.c
+++ b/Python/dynload_shlib.c
@@ -51,8 +51,10 @@ static struct {
static int nhandles = 0;
-dl_funcptr _PyImport_GetDynLoadFunc(const char *shortname,
- const char *pathname, FILE *fp)
+dl_funcptr
+_PyImport_FindSharedFuncptr(const char *prefix,
+ const char *shortname,
+ const char *pathname, FILE *fp)
{
dl_funcptr p;
void *handle;
@@ -67,26 +69,24 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *shortname,
}
PyOS_snprintf(funcname, sizeof(funcname),
- LEAD_UNDERSCORE "PyInit_%.200s", shortname);
+ LEAD_UNDERSCORE "%.20s_%.200s", prefix, shortname);
if (fp != NULL) {
int i;
- struct stat statb;
- if (fstat(fileno(fp), &statb) == -1) {
- PyErr_SetFromErrno(PyExc_IOError);
+ struct _Py_stat_struct status;
+ if (_Py_fstat(fileno(fp), &status) == -1)
return NULL;
- }
for (i = 0; i < nhandles; i++) {
- if (statb.st_dev == handles[i].dev &&
- statb.st_ino == handles[i].ino) {
+ if (status.st_dev == handles[i].dev &&
+ status.st_ino == handles[i].ino) {
p = (dl_funcptr) dlsym(handles[i].handle,
funcname);
return p;
}
}
if (nhandles < 128) {
- handles[nhandles].dev = statb.st_dev;
- handles[nhandles].ino = statb.st_ino;
+ handles[nhandles].dev = status.st_dev;
+ handles[nhandles].ino = status.st_ino;
}
}