diff options
-rw-r--r-- | lib/csu/common.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/csu/common.c b/lib/csu/common.c index 7862270eab5..721b113d93e 100644 --- a/lib/csu/common.c +++ b/lib/csu/common.c @@ -1,4 +1,4 @@ -/* $OpenBSD: common.c,v 1.8 2002/02/16 21:27:20 millert Exp $ */ +/* $OpenBSD: common.c,v 1.9 2002/06/05 22:09:53 espie Exp $ */ /* $NetBSD: common.c,v 1.4 1995/09/23 22:34:20 pk Exp $ */ /* * Copyright (c) 1993,1995 Paul Kranenburg @@ -34,7 +34,7 @@ #ifdef DYNAMIC typedef int (*rtld_entry_fn)(int, struct crt_ldso *); -static struct ld_entry *ld_entry; +static struct ld_entry **ld_entry; static void __load_rtld(dp) @@ -134,6 +134,7 @@ __load_rtld(dp) /* Call Sun's ld.so entry point: version 1, offset crt */ __call(CRT_VERSION_SUN, &crt, crt.crt_ba + sizeof hdr); #else + ld_entry = &crt.crt_ldentry; entry = (rtld_entry_fn)(crt.crt_ba + sizeof hdr); if ((*entry)(CRT_VERSION_BSD_4, &crt) == -1) { /* Feeble attempt to deal with out-dated ld.so */ @@ -146,8 +147,7 @@ __load_rtld(dp) ld_entry = dp->d_entry; return; } - ld_entry = crt.crt_ldentry; - atexit(ld_entry->dlexit); + atexit((*ld_entry)->dlexit); #endif #if defined(sun) && defined(DUPZFD) @@ -168,20 +168,20 @@ dlopen(name, mode) const char *name; int mode; { - if (ld_entry == NULL) + if ((*ld_entry) == NULL) return NULL; - return (ld_entry->dlopen)(name, mode); + return ((*ld_entry)->dlopen)(name, mode); } int dlclose(fd) void *fd; { - if (ld_entry == NULL) + if ((*ld_entry) == NULL) return -1; - return (ld_entry->dlclose)(fd); + return ((*ld_entry)->dlclose)(fd); } void * @@ -189,10 +189,10 @@ dlsym(fd, name) void *fd; const char *name; { - if (ld_entry == NULL) + if ((*ld_entry) == NULL) return NULL; - return (ld_entry->dlsym)(fd, name); + return ((*ld_entry)->dlsym)(fd, name); } int @@ -200,10 +200,10 @@ dlctl(fd, cmd, arg) void *fd, *arg; int cmd; { - if (ld_entry == NULL) + if ((*ld_entry) == NULL) return -1; - return (ld_entry->dlctl)(fd, cmd, arg); + return ((*ld_entry)->dlctl)(fd, cmd, arg); } const char * @@ -211,8 +211,8 @@ dlerror() { int error; - if (ld_entry == NULL || - (*ld_entry->dlctl)(NULL, DL_GETERRNO, &error) == -1) + if ((*ld_entry) == NULL || + ((*ld_entry)->dlctl)(NULL, DL_GETERRNO, &error) == -1) return "Service unavailable"; if (error == 0) |