summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-08-25 22:24:10 +0200
committerThomas Haller <thaller@redhat.com>2015-08-25 22:25:23 +0200
commit31902f8f6bcafd9efe351d9efcf554b757902007 (patch)
treeee44e8c606b7ef0ab0a5cc3d8590213ef094697c
parent677d802be60d1dd21d9bc4dc85ce7edb073021d9 (diff)
downloadNetworkManager-31902f8f6bcafd9efe351d9efcf554b757902007.tar.gz
platform: minor refactoring in _nl_get_vtable()
-rw-r--r--src/platform/nm-linux-platform.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 6114532bb7..9e4f3a2cfa 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -152,19 +152,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;