mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-11 07:30:16 +01:00
platform: minor refactoring in _nl_get_vtable()
(cherry picked from commit 31902f8f6b)
This commit is contained in:
parent
c2c192cd45
commit
424ff90497
1 changed files with 5 additions and 8 deletions
|
|
@ -153,19 +153,16 @@ _nl_get_vtable (void)
|
|||
static struct libnl_vtable vtable;
|
||||
|
||||
if (G_UNLIKELY (!vtable.f_nl_has_capability)) {
|
||||
void *handle;
|
||||
|
||||
handle = dlopen ("libnl-3.so.200", RTLD_LAZY | RTLD_NOLOAD);
|
||||
if (handle) {
|
||||
vtable.handle = handle;
|
||||
vtable.f_nl_has_capability = dlsym (handle, "nl_has_capability");
|
||||
vtable.handle = dlopen ("libnl-3.so.200", RTLD_LAZY | RTLD_NOLOAD);
|
||||
if (vtable.handle) {
|
||||
vtable.f_nl_has_capability = dlsym (vtable.handle, "nl_has_capability");
|
||||
}
|
||||
|
||||
if (!vtable.f_nl_has_capability)
|
||||
vtable.f_nl_has_capability = &_nl_f_nl_has_capability;
|
||||
|
||||
g_return_val_if_fail (handle, &vtable);
|
||||
g_return_val_if_fail (&nl_connect == (int (*) (struct nl_sock *, int)) dlsym (handle, "nl_connect"), &vtable);
|
||||
g_return_val_if_fail (vtable.handle, &vtable);
|
||||
g_return_val_if_fail (&nl_connect == (int (*) (struct nl_sock *, int)) dlsym (vtable.handle, "nl_connect"), &vtable);
|
||||
}
|
||||
|
||||
return &vtable;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue