]> git.meshlink.io Git - meshlink/commitdiff
Fix all warnings when compiling with mingw64.
authorGuus Sliepen <guus@tinc-vpn.org>
Sat, 1 May 2010 13:39:59 +0000 (15:39 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Sat, 1 May 2010 13:39:59 +0000 (15:39 +0200)
src/logger.c
src/net.c
src/net_socket.c
src/process.c
src/process.h
src/tincd.c

index a1cc2073c0015760fe6879648ca16f85b2a92a26..bc20438cc83cc3f07c13ad9115b5fc1699e8a9bb 100644 (file)
@@ -85,7 +85,7 @@ void logger(int priority, const char *format, ...) {
 #ifdef HAVE_MINGW
                        {
                                char message[4096];
-                               char *messages[] = {message};
+                               const char *messages[] = {message};
                                vsnprintf(message, sizeof(message), format, ap);
                                ReportEvent(loghandle, priority, 0, 0, NULL, 1, 0, messages, NULL);
                        }
index a04ba005b67fc616e8291a4f80dddb9ff9c50af8..64bca947ff08b80c25b4735e68b06321c4e5ae39 100644 (file)
--- a/src/net.c
+++ b/src/net.c
@@ -297,7 +297,7 @@ static void check_network_activity(fd_set * readset, fd_set * writeset) {
                if(FD_ISSET(c->socket, readset)) {
                        if(c->status.connecting) {
                                c->status.connecting = false;
-                               getsockopt(c->socket, SOL_SOCKET, SO_ERROR, &result, &len);
+                               getsockopt(c->socket, SOL_SOCKET, SO_ERROR, (void *)&result, &len);
 
                                if(!result)
                                        finish_connecting(c);
index 96e268fa98c8ffb3430632e613cd46f2228b2519..762c0a224d0561976079c803fcd85a8fcc3f9cd6 100644 (file)
@@ -70,12 +70,12 @@ static void configure_tcp(connection_t *c) {
 
 #if defined(SOL_TCP) && defined(TCP_NODELAY)
        option = 1;
-       setsockopt(c->socket, SOL_TCP, TCP_NODELAY, &option, sizeof(option));
+       setsockopt(c->socket, SOL_TCP, TCP_NODELAY, (void *)&option, sizeof(option));
 #endif
 
 #if defined(SOL_IP) && defined(IP_TOS) && defined(IPTOS_LOWDELAY)
        option = IPTOS_LOWDELAY;
-       setsockopt(c->socket, SOL_IP, IP_TOS, &option, sizeof(option));
+       setsockopt(c->socket, SOL_IP, IP_TOS, (void *)&option, sizeof(option));
 #endif
 }
 
@@ -95,7 +95,7 @@ static bool bind_to_interface(int sd) {
        strncpy(ifr.ifr_ifrn.ifrn_name, iface, IFNAMSIZ);
        ifr.ifr_ifrn.ifrn_name[IFNAMSIZ - 1] = 0;
 
-       status = setsockopt(sd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr));
+       status = setsockopt(sd, SOL_SOCKET, SO_BINDTODEVICE, (void *)&ifr, sizeof(ifr));
        if(status) {
                logger(LOG_ERR, "Can't bind to interface %s: %s", iface,
                                strerror(errno));
@@ -181,11 +181,11 @@ int setup_listen_socket(const sockaddr_t *sa) {
        /* Optimize TCP settings */
 
        option = 1;
-       setsockopt(nfd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option));
+       setsockopt(nfd, SOL_SOCKET, SO_REUSEADDR, (void *)&option, sizeof(option));
 
 #if defined(SOL_IPV6) && defined(IPV6_V6ONLY)
        if(sa->sa.sa_family == AF_INET6)
-               setsockopt(nfd, SOL_IPV6, IPV6_V6ONLY, &option, sizeof option);
+               setsockopt(nfd, SOL_IPV6, IPV6_V6ONLY, (void *)&option, sizeof option);
 #endif
 
        if(get_config_string
@@ -196,7 +196,7 @@ int setup_listen_socket(const sockaddr_t *sa) {
                memset(&ifr, 0, sizeof(ifr));
                strncpy(ifr.ifr_ifrn.ifrn_name, iface, IFNAMSIZ);
 
-               if(setsockopt(nfd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr))) {
+               if(setsockopt(nfd, SOL_SOCKET, SO_BINDTODEVICE, (void *)&ifr, sizeof(ifr))) {
                        closesocket(nfd);
                        logger(LOG_ERR, "Can't bind to interface %s: %s", iface,
                                   strerror(sockerrno));
@@ -259,11 +259,11 @@ int setup_vpn_in_socket(const sockaddr_t *sa) {
 #endif
 
        option = 1;
-       setsockopt(nfd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option));
+       setsockopt(nfd, SOL_SOCKET, SO_REUSEADDR, (void *)&option, sizeof(option));
 
 #if defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY)
        if(sa->sa.sa_family == AF_INET6)
-               setsockopt(nfd, IPPROTO_IPV6, IPV6_V6ONLY, &option, sizeof option);
+               setsockopt(nfd, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&option, sizeof option);
 #endif
 
 #if defined(IP_DONTFRAG) && !defined(IP_DONTFRAGMENT)
@@ -273,12 +273,12 @@ int setup_vpn_in_socket(const sockaddr_t *sa) {
 #if defined(SOL_IP) && defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DO)
        if(myself->options & OPTION_PMTU_DISCOVERY) {
                option = IP_PMTUDISC_DO;
-               setsockopt(nfd, SOL_IP, IP_MTU_DISCOVER, &option, sizeof(option));
+               setsockopt(nfd, SOL_IP, IP_MTU_DISCOVER, (void *)&option, sizeof(option));
        }
 #elif defined(IPPROTO_IP) && defined(IP_DONTFRAGMENT)
        if(myself->options & OPTION_PMTU_DISCOVERY) {
                option = 1;
-               setsockopt(nfd, IPPROTO_IP, IP_DONTFRAGMENT, &option, sizeof(option));
+               setsockopt(nfd, IPPROTO_IP, IP_DONTFRAGMENT, (void *)&option, sizeof(option));
        }
 #else
 #warning No way to disable IPv4 fragmentation
@@ -287,12 +287,12 @@ int setup_vpn_in_socket(const sockaddr_t *sa) {
 #if defined(SOL_IPV6) && defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DO)
        if(myself->options & OPTION_PMTU_DISCOVERY) {
                option = IPV6_PMTUDISC_DO;
-               setsockopt(nfd, SOL_IPV6, IPV6_MTU_DISCOVER, &option, sizeof(option));
+               setsockopt(nfd, SOL_IPV6, IPV6_MTU_DISCOVER, (void *)&option, sizeof(option));
        }
 #elif defined(IPPROTO_IPV6) && defined(IPV6_DONTFRAG)
        if(myself->options & OPTION_PMTU_DISCOVERY) {
                option = 1;
-               setsockopt(nfd, IPPROTO_IPV6, IPV6_DONTFRAG, &option, sizeof(option));
+               setsockopt(nfd, IPPROTO_IPV6, IPV6_DONTFRAG, (void *)&option, sizeof(option));
        }
 #else
 #warning No way to disable IPv6 fragmentation
@@ -410,7 +410,7 @@ begin:
 #if defined(SOL_IPV6) && defined(IPV6_V6ONLY)
        int option = 1;
        if(c->address.sa.sa_family == AF_INET6)
-               setsockopt(c->socket, SOL_IPV6, IPV6_V6ONLY, &option, sizeof option);
+               setsockopt(c->socket, SOL_IPV6, IPV6_V6ONLY, (void *)&option, sizeof option);
 #endif
 
        bind_to_interface(c->socket);
index 6d0e499aa5fddbf7aa031ffa8301028f3ef3670b..f2fff1dc6d0446c0ab36c66921b74e26995dcc99 100644 (file)
@@ -43,7 +43,9 @@ extern char **g_argv;
 extern bool use_logfile;
 extern volatile bool running;
 
+#ifndef HAVE_MINGW
 sigset_t emptysigset;
+#endif
 
 static int saved_debug_level = -1;
 
index bb42cd0fc3779d00a3d930f4b6511e079ad85992..8d2d56211323c577b7d742a14637ce04a37f287b 100644 (file)
@@ -30,4 +30,8 @@ extern bool execute_script(const char *, char **);
 extern bool detach(void);
 extern bool kill_other(int);
 
+#ifdef HAVE_MINGW
+extern bool init_service(void);
+#endif
+
 #endif                                                 /* __TINC_PROCESS_H__ */
index 3debb3e48c2992204e6169d9df02da35c06123ff..e1eb3b3d471933b91bbf335d471bab754ceacd74 100644 (file)
@@ -118,6 +118,7 @@ static struct option const long_options[] = {
 #ifdef HAVE_MINGW
 static struct WSAData wsa_state;
 CRITICAL_SECTION mutex;
+int main2(int argc, char **argv);
 #endif
 
 static void usage(bool status) {