Skip to content
Snippets Groups Projects
Commit 3f78bcfd authored by Tomasz Grabiec's avatar Tomasz Grabiec Committed by Pekka Enberg
Browse files

libc: make dlopen() return main program for empty file name


This is not a documented behavior but glibc's dlopen behaves this way.

Spotted when debugging assertion failure when java is started with a
debugger, we try to read elf header from "/" on dlopen("", ...):

Assertion failed: data.uio_resid == 0 (osv/fs/fs.cc: read: 27)

Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
parent b97c0e3a
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,7 @@ static void dlerror_fmt(const char *fmt, ...)
void* dlopen(const char* filename, int flags)
{
if (!filename) {
if (!filename || !strcmp(filename, "")) {
// It is strange that we are returning a program while
// dlsym will always try to open an object. We may have to
// revisit this later, specially if this affect the ordering
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment