Make rk_SOCK_INIT an inline function and check the result to avoid warnings
Similar to f6e0d19cc0
but
fixed in the header by making it a proper static inline
function (as some callers treats it as one, so do it
for all now for consistency).
Seen on Ubuntu 18.04 with
giving:
In file included from getaddrinfo-test.c:36:0:
getaddrinfo-test.c: In function ‘main’:
roken.h:110:24: error: statement with no effect [-Werror=unused-value]
#define rk_SOCK_INIT() 0
^
getaddrinfo-test.c:132:5: note: in expansion of macro ‘rk_SOCK_INIT’
rk_SOCK_INIT();
^~~~~~~~~~~~
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:

committed by
Jeffrey Altman

parent
9ffbc17a0f
commit
bf3c4219fe
@@ -129,7 +129,8 @@ main(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
rk_SOCK_INIT();
|
||||
if (rk_SOCK_INIT())
|
||||
errx(1, "Couldn't initialize sockets. Err=%d\n", rk_SOCK_ERRNO);
|
||||
|
||||
argc -= optidx;
|
||||
argv += optidx;
|
||||
|
@@ -132,7 +132,10 @@ typedef int rk_socket_t;
|
||||
#define rk_SOCK_ERRNO errno
|
||||
#define rk_INVALID_SOCKET (-1)
|
||||
|
||||
#define rk_SOCK_INIT() 0
|
||||
static inline ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_SOCK_INIT(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define rk_SOCK_EXIT() do { } while(0)
|
||||
|
||||
#endif /* WinSock */
|
||||
|
@@ -253,7 +253,8 @@ do_client(void)
|
||||
{
|
||||
int rv = 0;
|
||||
|
||||
rk_SOCK_INIT();
|
||||
if (rk_SOCK_INIT())
|
||||
errx(1, "Couldn't initialize sockets. Err=%d\n", rk_SOCK_ERRNO);
|
||||
|
||||
prog = "Client";
|
||||
is_client = 1;
|
||||
@@ -272,7 +273,8 @@ do_server(void)
|
||||
{
|
||||
int rv = 0;
|
||||
|
||||
rk_SOCK_INIT();
|
||||
if (rk_SOCK_INIT())
|
||||
errx(1, "Couldn't initialize sockets. Err=%d\n", rk_SOCK_ERRNO);
|
||||
|
||||
prog = "Server";
|
||||
|
||||
|
Reference in New Issue
Block a user