From 5fbcfd632a7446da946a8b1e27004a401b8d74f3 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Wed, 25 Jan 2017 22:20:07 -0800 Subject: Clean up some UN*X-vs-Windows socket issues. Have a wsutil/socket.h file, for inclusion by everything that uses sockets, that contains the UN*X-vs-Windows #includes and #defines to hide some UN*X-sockets vs. Winsock API differences. That stuff mostly comes from from extcap/extcap-base.h; have that file just include wsutil/socket.h rather than defining that stuff itself. Include it in sharkd_daemon.c. Use socklen_t for the size of things to pass to bind() as the last argument; wsutil/socket.h defines it as int on Windows. Ignore sharkd in Git. Change-Id: I3f2171b7aa613717f52305f62bfd7d43e0172dc6 Reviewed-on: https://code.wireshark.org/review/19796 Petri-Dish: Guy Harris Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris --- sharkd_daemon.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) (limited to 'sharkd_daemon.c') diff --git a/sharkd_daemon.c b/sharkd_daemon.c index 408c6dbd8d..ca176ca097 100644 --- a/sharkd_daemon.c +++ b/sharkd_daemon.c @@ -35,9 +35,7 @@ #include #endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif +#include #ifdef HAVE_NETINET_IN_H #include @@ -48,23 +46,6 @@ #include #endif -/* -#if defined(_WIN32) - #ifdef HAVE_WINDOWS_H - #include - #endif - - #include - - #ifdef HAVE_WINSOCK2_H - #include - #endif -#endif -*/ -#ifdef HAVE_ARPA_INET_H -#include -#endif - #include #include "sharkd.h" @@ -80,7 +61,7 @@ socket_init(char *path) if (!strncmp(path, "unix:", 5)) { struct sockaddr_un s_un; - size_t s_un_len; + socklen_t s_un_len; path += 5; @@ -95,7 +76,7 @@ socket_init(char *path) s_un.sun_family = AF_UNIX; g_strlcpy(s_un.sun_path, path, sizeof(s_un.sun_path)); - s_un_len = offsetof(struct sockaddr_un, sun_path) + strlen(s_un.sun_path); + s_un_len = (socklen_t)(offsetof(struct sockaddr_un, sun_path) + strlen(s_un.sun_path)); if (s_un.sun_path[0] == '@') s_un.sun_path[0] = '\0'; -- cgit v1.2.3