From 7da7c45951c87628cce8fed4772e82e4854fe8ee Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sun, 6 Jul 2008 13:50:28 +0000 Subject: [PATCH] * when finding out whether or not R5 compatibility mode is required, we may have to scan loaded libraries, too, as the dependency on network libraries may not be present in the executable image, but may be "hidden" in one of those library images (as is the case with Beam). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26277 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/network/init.cpp | 45 ++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/src/kits/network/init.cpp b/src/kits/network/init.cpp index 624970f034..e5dda1270e 100644 --- a/src/kits/network/init.cpp +++ b/src/kits/network/init.cpp @@ -4,6 +4,7 @@ * * Authors: * Axel Dörfler, axeld@pinc-software.de + * Oliver Tappe, zooey@hirschkaefer.de */ @@ -59,25 +60,31 @@ initialize_before() // We're using the BeOS startup code, check if BONE libraries are in // use, and if not, enable the R5 compatibility layer. - - const char *name; - cookie = 0; + // As dependencies to network libraries may be "hidden" in libraries, we + // may have to scan not only the executable, but every loaded image. int enable = 0; + uint32 crumble; + const char *name; + do { + crumble = 0; + while (__get_next_image_dependency(info.id, &crumble, &name) == B_OK) { + if (!strcmp(name, "libbind.so") + || !strcmp(name, "libsocket.so") + || !strcmp(name, "libbnetapi.so") + || !strcmp(name, "libnetwork.so")) + enable -= 2; + else if (!strcmp(name, "libnet.so") + || !strcmp(name, "libnetapi.so")) + enable++; + } - while (__get_next_image_dependency(info.id, &cookie, &name) == B_OK) { - if (!strcmp(name, "libbind.so") - || !strcmp(name, "libsocket.so") - || !strcmp(name, "libbnetapi.so") - || !strcmp(name, "libnetwork.so")) - enable -= 2; - else if (!strcmp(name, "libnet.so") - || !strcmp(name, "libnetapi.so")) - enable++; - } - - if (enable > 0) { - __gR5Compatibility = true; - find_own_image(); - debug_printf("libnetwork.so running in R5 compatibility mode.\n"); - } + if (enable > 0) { + __gR5Compatibility = true; + find_own_image(); + debug_printf("libnetwork.so running in R5 compatibility mode.\n"); + return; + } + } while(enable == 0 + && get_next_image_info(B_CURRENT_TEAM, (int32 *)&cookie, &info) + == B_OK); }