提交 0e4dae3d 编写于 作者: R Rich Felker

in dlopen: don't use null pointer

deps can be null if a library has no dependencies (such as libc itself)
上级 92ab5d8d
...@@ -514,19 +514,19 @@ void *dlopen(const char *file, int mode) ...@@ -514,19 +514,19 @@ void *dlopen(const char *file, int mode)
/* First load handling */ /* First load handling */
if (!p->deps) { if (!p->deps) {
load_deps(p); load_deps(p);
for (i=0; p->deps[i]; i++) if (p->deps) for (i=0; p->deps[i]; i++)
if (!p->deps[i]->global) if (!p->deps[i]->global)
p->deps[i]->global = -1; p->deps[i]->global = -1;
if (!p->global) p->global = -1; if (!p->global) p->global = -1;
reloc_all(p); reloc_all(p);
for (i=0; p->deps[i]; i++) if (p->deps) for (i=0; p->deps[i]; i++)
if (p->deps[i]->global < 0) if (p->deps[i]->global < 0)
p->deps[i]->global = 0; p->deps[i]->global = 0;
if (p->global < 0) p->global = 0; if (p->global < 0) p->global = 0;
} }
if (mode & RTLD_GLOBAL) { if (mode & RTLD_GLOBAL) {
for (i=0; p->deps[i]; i++) if (p->deps) for (i=0; p->deps[i]; i++)
p->deps[i]->global = 1; p->deps[i]->global = 1;
p->global = 1; p->global = 1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册