From 67715f042096b4f77e359823f2c8d330f2b965b9 Mon Sep 17 00:00:00 2001 From: Neal Norwitz Date: Wed, 9 Nov 2005 06:59:35 +0000 Subject: - 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. --- Python/dynload_shlib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Python/dynload_shlib.c') diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c index 2b5a11a220..960e5c0933 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) -- cgit v1.2.1