fix stale pointer issue in dynamic linker with dlopen
authorRich Felker <dalias@aerifal.cx>
Mon, 27 Jun 2011 02:39:34 +0000 (22:39 -0400)
committerRich Felker <dalias@aerifal.cx>
Mon, 27 Jun 2011 02:39:34 +0000 (22:39 -0400)
src/ldso/dynlink.c

index 62dd9db78a5306089c6a09880b14ec58feeca41c..9a0697c8f9fb83148d010ae64922a9731f047204 100644 (file)
@@ -473,6 +473,7 @@ void *__dynlink(int argc, char **argv, size_t *got)
                *libc->prev->next = *libc;
                libc = libc->prev->next;
                if (libc->next) libc->next->prev = libc;
+               if (tail == &lib) tail = libc;
        } else {
                free_all(head);
                free(sys_path);