summaryrefslogtreecommitdiffstats
path: root/Python/dynload_shlib.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2005-11-09 06:59:35 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2005-11-09 06:59:35 (GMT)
commit67715f042096b4f77e359823f2c8d330f2b965b9 (patch)
tree83d2961d97bc266a38fee7da13b9d0c5c418a205 /Python/dynload_shlib.c
parent789fd005e0d3b3ee047435f7536ded80a26ddff8 (diff)
downloadcpython-67715f042096b4f77e359823f2c8d330f2b965b9.zip
cpython-67715f042096b4f77e359823f2c8d330f2b965b9.tar.gz
cpython-67715f042096b4f77e359823f2c8d330f2b965b9.tar.bz2
- SF Bug #1350188, "setdlopenflags" leads to crash upon "import"
It was possible dlerror() returns a NULL pointer, use a default error message in this case.
Diffstat (limited to 'Python/dynload_shlib.c')
-rw-r--r--Python/dynload_shlib.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c
index 2b5a11a..960e5c0 100644
--- a/Python/dynload_shlib.c
+++ b/Python/dynload_shlib.c
@@ -130,7 +130,10 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
handle = dlopen(pathname, dlopenflags);
if (handle == NULL) {
- PyErr_SetString(PyExc_ImportError, dlerror());
+ char *error = dlerror();
+ if (error == NULL)
+ error = "unknown dlopen() error";
+ PyErr_SetString(PyExc_ImportError, error);
return NULL;
}
if (fp != NULL && nhandles < 128)