From 0c041b19587034bd0e0265eeae90cc033c55e658 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Mon, 24 Jun 2019 16:03:55 -0700 Subject: [PATCH] ip: Fix get_link_kind when linked statically --- ip/iplink.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 86 insertions(+), 9 deletions(-) diff --git a/ip/iplink.c b/ip/iplink.c index edb88b02..5f5d81e1 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -152,21 +152,98 @@ struct link_util *get_link_kind(const char *id) char buf[256]; struct link_util *l; + if (linkutil_list == NULL) { + // next) if (strcmp(l->id, id) == 0) return l; snprintf(buf, sizeof(buf), LIBDIR "/ip/link_%s.so", id); dlh = dlopen(buf, RTLD_LAZY); - if (dlh == NULL) { - /* look in current binary, only open once */ - dlh = BODY; - if (dlh == NULL) { - dlh = BODY = dlopen(NULL, RTLD_LAZY); - if (dlh == NULL) - return NULL; - } - } + if (dlh == NULL) + return NULL; snprintf(buf, sizeof(buf), "%s_link_util", id); l = dlsym(dlh, buf); -- 2.25.0