diff options
author | George Joseph <gjoseph@digium.com> | 2016-06-09 08:20:33 -0600 |
---|---|---|
committer | George Joseph <gjoseph@digium.com> | 2016-06-09 09:50:00 -0500 |
commit | a99ddc6a0d2b9075c2cc436a6770c8ac889f5286 (patch) | |
tree | 7c9b835eb9ed843ffeb164b8df7c4833db1aec8a /tests/test_netsock2.c | |
parent | bd3b6e9f193c7f07d86070df4866a4f5cbd82055 (diff) |
build: Fix ast_sockaddr initialization to be more portable
A change to glibc 2.22 changed the order of the sockadddr_storage
members which caused the places where we do an initialization of
ast_sockaddr with '{ { 0, 0, } }' to fail compilation. Those
initializers (which we shouldn't have been using anyway) have been
replaced with memsets.
Change-Id: Idd1b3b320903d8771bfe221f0b015685de628fa4
Diffstat (limited to 'tests/test_netsock2.c')
-rw-r--r-- | tests/test_netsock2.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/test_netsock2.c b/tests/test_netsock2.c index e182b0a75..fec1ae2d5 100644 --- a/tests/test_netsock2.c +++ b/tests/test_netsock2.c @@ -75,7 +75,7 @@ AST_TEST_DEFINE(parsing) }; size_t x; - struct ast_sockaddr addr = { { 0, 0, } }; + struct ast_sockaddr addr; int parse_result; switch (cmd) { @@ -91,15 +91,17 @@ AST_TEST_DEFINE(parsing) } for (x = 0; x < ARRAY_LEN(test_vals); x++) { + memset(&addr, 0, sizeof(addr)); if ((parse_result = ast_sockaddr_parse(&addr, test_vals[x].address, 0)) != test_vals[x].expected_result) { ast_test_status_update(test, "On '%s' expected %d but got %d\n", test_vals[x].address, test_vals[x].expected_result, parse_result); res = AST_TEST_FAIL; } if (parse_result) { - struct ast_sockaddr tmp_addr = { { 0, 0, } }; + struct ast_sockaddr tmp_addr; const char *tmp; tmp = ast_sockaddr_stringify(&addr); + memset(&tmp_addr, 0, sizeof(tmp_addr)); ast_sockaddr_parse(&tmp_addr, tmp, 0); if (ast_sockaddr_cmp_addr(&addr, &tmp_addr)) { char buf[64]; |