diff options
author | Chris Grahn <grahn@posteo.net> | 2017-12-01 19:41:45 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-12-08 14:00:30 (GMT) |
commit | 165611034621b0eda1a4747ea382600fed436437 (patch) | |
tree | 271eff08b4c4353cb79a206723f0b9dc5d160416 /tests | |
parent | 3c427d0f4fcca91a661d85d21cdea89d41271c6c (diff) | |
download | libnl-165611034621b0eda1a4747ea382600fed436437.zip libnl-165611034621b0eda1a4747ea382600fed436437.tar.gz libnl-165611034621b0eda1a4747ea382600fed436437.tar.bz2 |
tests: fix bug in test-create-bridge.c
The call to rtnl_link_get_master() at the end of the example can
misleadingly fail because the nl_cache isn't refilled after adding the
test interface to the test bridge.
This commit changes the example to refill the cache before calling
rtnl_link_get_master().
https://github.com/thom311/libnl/pull/158
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-create-bridge.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/test-create-bridge.c b/tests/test-create-bridge.c index fe10c63..afd20e1 100644 --- a/tests/test-create-bridge.c +++ b/tests/test-create-bridge.c @@ -67,6 +67,11 @@ int main(int argc, char *argv[]) fprintf(stderr, "Link is not a bridge\n"); return -2; } + + rtnl_link_put(ltap); + nl_cache_refill(sk, link_cache); + ltap = rtnl_link_get_by_name(link_cache, TEST_INTERFACE_NAME); + if(rtnl_link_get_master(ltap) <= 0) { fprintf(stderr, "Interface is not attached to a bridge\n"); return -3; |