Util: Fix socket code to not use struct designated initialization
Jeffrey Pfau jeffrey@endrift.com
Wed, 07 Jan 2015 02:06:38 -0800
1 files changed,
8 insertions(+),
10 deletions(-)
jump to
M
src/util/socket.h
→
src/util/socket.h
@@ -50,11 +50,10 @@ if (SOCKET_FAILED(sock)) {
return sock; } - struct sockaddr_in bindInfo = { - .sin_family = AF_INET, - .sin_port = htons(port), - .sin_addr = { 0 } - }; + struct sockaddr_in bindInfo; + memset(&bindInfo, 0, sizeof(bindInfo)); + bindInfo.sin_family = AF_INET; + bindInfo.sin_port = htons(port); bindInfo.sin_addr.s_addr = htonl(bindAddress); int err = bind(sock, (const struct sockaddr*) &bindInfo, sizeof(struct sockaddr_in)); if (err) {@@ -70,11 +69,10 @@ if (SOCKET_FAILED(sock)) {
return sock; } - struct sockaddr_in bindInfo = { - .sin_family = AF_INET, - .sin_port = htons(port), - .sin_addr = { 0 } - }; + struct sockaddr_in bindInfo; + memset(&bindInfo, 0, sizeof(bindInfo)); + bindInfo.sin_family = AF_INET; + bindInfo.sin_port = htons(port); bindInfo.sin_addr.s_addr = htonl(destinationAddress); int err = connect(sock, (const struct sockaddr*) &bindInfo, sizeof(struct sockaddr_in)); if (err) {