Improve handling invitation read errors.
[tinc] / src / sptps_test.c
index 0f62af0..baca66b 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <getopt.h>
 
-#ifdef HAVE_MINGW
+#ifdef HAVE_WINDOWS
 #include <pthread.h>
 #endif
 
@@ -35,8 +35,9 @@
 #include "protocol.h"
 #include "sptps.h"
 #include "utils.h"
+#include "names.h"
 
-#ifndef HAVE_MINGW
+#ifndef HAVE_WINDOWS
 #define closesocket(s) close(s)
 #endif
 
@@ -56,7 +57,6 @@ bool send_meta(struct connection_t *c, const void *msg, size_t len) {
        return false;
 }
 
-char *logfilename = NULL;
 bool do_detach = false;
 struct timeval now;
 
@@ -136,8 +136,6 @@ static struct option const long_options[] = {
        {NULL, 0, NULL, 0}
 };
 
-const char *program_name;
-
 static void usage(void) {
        static const char *message =
                "Usage: %s [options] my_ed25519_key_file his_ed25519_key_file [host] port\n"
@@ -162,7 +160,7 @@ static void usage(void) {
        fprintf(stderr, message, program_name);
 }
 
-#ifdef HAVE_MINGW
+#ifdef HAVE_WINDOWS
 
 int stdin_sock_fd = -1;
 
@@ -310,7 +308,7 @@ server_err:
        return -1;
 }
 
-#endif // HAVE_MINGW
+#endif // HAVE_WINDOWS
 
 int main(int argc, char *argv[]) {
        program_name = argv[0];
@@ -430,7 +428,7 @@ int main(int argc, char *argv[]) {
 
 #endif
 
-#ifdef HAVE_MINGW
+#ifdef HAVE_WINDOWS
        static struct WSAData wsa_state;
 
        if(WSAStartup(MAKEWORD(2, 2), &wsa_state)) {
@@ -568,7 +566,7 @@ int main(int argc, char *argv[]) {
                return 1;
        }
 
-#ifdef HAVE_MINGW
+#ifdef HAVE_WINDOWS
 
        if(!readonly) {
                in = start_input_reader();
@@ -609,7 +607,7 @@ int main(int argc, char *argv[]) {
                }
 
                if(FD_ISSET(in, &fds)) {
-#ifdef HAVE_MINGW
+#ifdef HAVE_WINDOWS
                        ssize_t len = recv(in, buf, readsize, 0);
 #else
                        ssize_t len = read(in, buf, readsize);
@@ -623,7 +621,7 @@ int main(int argc, char *argv[]) {
                        }
 
                        if(len == 0) {
-#ifdef HAVE_MINGW
+#ifdef HAVE_WINDOWS
                                shutdown(in, SD_SEND);
                                closesocket(in);
 #endif