Add some debug diagnostics for dlopen.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4822 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1998-04-26 15:16:57 +00:00
parent e269f1deb0
commit e4b13a8b1c

View File

@@ -40,6 +40,8 @@
RCSID("$Id$"); RCSID("$Id$");
int _kafs_debug; /* this should be done in a better way */
/* Magic to get AIX syscalls to work */ /* Magic to get AIX syscalls to work */
#ifdef _AIX #ifdef _AIX
@@ -71,16 +73,23 @@ aix_setup(void)
* If we are root or running setuid don't trust AFSLIBPATH! * If we are root or running setuid don't trust AFSLIBPATH!
*/ */
if (getuid() != 0 && !isSuid() && (p = getenv("AFSLIBPATH")) != NULL) if (getuid() != 0 && !isSuid() && (p = getenv("AFSLIBPATH")) != NULL)
strcpy(path, p); snprintf(path, sizeof(path), "%s", p);
else else
snprintf(path, sizeof(path), "%s/afslib.so", LIBDIR); snprintf(path, sizeof(path), "%s/afslib.so", LIBDIR);
ptr = dlopen(path, 0); ptr = dlopen(path, RTLD_NOW);
if(ptr){ if(ptr == NULL) {
Setpag = (int (*)(void))dlsym(ptr, "aix_setpag"); if(_kafs_debug) {
Pioctl = (int (*)(char*, int, if(errno == ENOEXEC && (p = dlerror()) != NULL)
struct ViceIoctl*, int))dlsym(ptr, "aix_pioctl"); warnx("%s: %s", path, p);
else if (errno != ENOENT)
warn("%s", path);
}
return;
} }
Setpag = (int (*)(void))dlsym(ptr, "aix_setpag");
Pioctl = (int (*)(char*, int,
struct ViceIoctl*, int))dlsym(ptr, "aix_pioctl");
#endif #endif
} }
#endif /* _AIX */ #endif /* _AIX */