projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rewrite integration test suite in Python
[tinc]
/
src
/
tincctl.c
diff --git
a/src/tincctl.c
b/src/tincctl.c
index
0e7d083
..
5ae76d3
100644
(file)
--- a/
src/tincctl.c
+++ b/
src/tincctl.c
@@
-19,8
+19,6
@@
#include "system.h"
#include "system.h"
-#include <getopt.h>
-
#ifdef HAVE_READLINE
#include "readline/readline.h"
#include "readline/history.h"
#ifdef HAVE_READLINE
#include "readline/readline.h"
#include "readline/history.h"
@@
-283,7
+281,7
@@
ask_filename:
}
}
}
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
if(filename[0] != '\\' && filename[0] != '/' && !strchr(filename, ':')) {
#else
if(filename[0] != '\\' && filename[0] != '/' && !strchr(filename, ':')) {
#else
@@
-646,14
+644,14
@@
static bool stop_tincd(void) {
// wait for tincd to close the connection...
}
// wait for tincd to close the connection...
}
- close(fd);
+ close
socket
(fd);
pid = 0;
fd = -1;
return true;
}
pid = 0;
fd = -1;
return true;
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
static bool remove_service(void) {
SC_HANDLE manager = NULL;
SC_HANDLE service = NULL;
static bool remove_service(void) {
SC_HANDLE manager = NULL;
SC_HANDLE service = NULL;
@@
-719,7
+717,7
@@
bool connect_tincd(bool verbose) {
if(select(fd + 1, &r, NULL, NULL, &tv)) {
fprintf(stderr, "Previous connection to tincd lost, reconnecting.\n");
if(select(fd + 1, &r, NULL, NULL, &tv)) {
fprintf(stderr, "Previous connection to tincd lost, reconnecting.\n");
- close(fd);
+ close
socket
(fd);
fd = -1;
} else {
return true;
fd = -1;
} else {
return true;
@@
-750,7
+748,7
@@
bool connect_tincd(bool verbose) {
fclose(f);
fclose(f);
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
if((pid == 0) || (kill(pid, 0) && (errno == ESRCH))) {
fprintf(stderr, "Could not find tincd running at pid %d\n", pid);
if((pid == 0) || (kill(pid, 0) && (errno == ESRCH))) {
fprintf(stderr, "Could not find tincd running at pid %d\n", pid);
@@
-786,7
+784,7
@@
bool connect_tincd(bool verbose) {
fprintf(stderr, "Cannot connect to UNIX socket %s: %s\n", unixsocketname, sockstrerror(sockerrno));
}
fprintf(stderr, "Cannot connect to UNIX socket %s: %s\n", unixsocketname, sockstrerror(sockerrno));
}
- close(fd);
+ close
socket
(fd);
fd = -1;
return false;
}
fd = -1;
return false;
}
@@
-832,7
+830,7
@@
bool connect_tincd(bool verbose) {
fprintf(stderr, "Cannot connect to %s port %s: %s\n", host, port, sockstrerror(sockerrno));
}
fprintf(stderr, "Cannot connect to %s port %s: %s\n", host, port, sockstrerror(sockerrno));
}
- close(fd);
+ close
socket
(fd);
fd = -1;
return false;
}
fd = -1;
return false;
}
@@
-855,7
+853,7
@@
bool connect_tincd(bool verbose) {
fprintf(stderr, "Cannot read greeting from control socket: %s\n", sockstrerror(sockerrno));
}
fprintf(stderr, "Cannot read greeting from control socket: %s\n", sockstrerror(sockerrno));
}
- close(fd);
+ close
socket
(fd);
fd = -1;
return false;
}
fd = -1;
return false;
}
@@
-865,7
+863,7
@@
bool connect_tincd(bool verbose) {
fprintf(stderr, "Could not fully establish control socket connection\n");
}
fprintf(stderr, "Could not fully establish control socket connection\n");
}
- close(fd);
+ close
socket
(fd);
fd = -1;
return false;
}
fd = -1;
return false;
}
@@
-888,7
+886,7
@@
static int cmd_start(int argc, char *argv[]) {
char *c;
char *slash = strrchr(program_name, '/');
char *c;
char *slash = strrchr(program_name, '/');
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
if((c = strrchr(program_name, '\\')) > slash) {
slash = c;
if((c = strrchr(program_name, '\\')) > slash) {
slash = c;
@@
-906,7
+904,7
@@
static int cmd_start(int argc, char *argv[]) {
char **nargv = xzalloc((optind + argc) * sizeof(*nargv));
char *arg0 = c;
char **nargv = xzalloc((optind + argc) * sizeof(*nargv));
char *arg0 = c;
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
/*
Windows has no real concept of an "argv array". A command line is just one string.
The CRT of the new process will decode the command line string to generate argv before calling main(), and (by convention)
/*
Windows has no real concept of an "argv array". A command line is just one string.
The CRT of the new process will decode the command line string to generate argv before calling main(), and (by convention)
@@
-927,7
+925,7
@@
static int cmd_start(int argc, char *argv[]) {
nargv[nargc++] = argv[i];
}
nargv[nargc++] = argv[i];
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
int status = spawnvp(_P_WAIT, c, nargv);
free(nargv);
int status = spawnvp(_P_WAIT, c, nargv);
free(nargv);
@@
-1026,7
+1024,7
@@
static int cmd_stop(int argc, char *argv[]) {
return 1;
}
return 1;
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
return remove_service() ? EXIT_SUCCESS : EXIT_FAILURE;
#else
return remove_service() ? EXIT_SUCCESS : EXIT_FAILURE;
#else
@@
-1530,7
+1528,7
@@
static int cmd_log(int argc, char *argv[]) {
signal(SIGINT, SIG_DFL);
#endif
signal(SIGINT, SIG_DFL);
#endif
- close(fd);
+ close
socket
(fd);
fd = -1;
return 0;
}
fd = -1;
return 0;
}
@@
-2060,7
+2058,7
@@
static int cmd_config(int argc, char *argv[]) {
}
// Replace the configuration file with the new one
}
// Replace the configuration file with the new one
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
if(remove(filename)) {
fprintf(stderr, "Error replacing file %s: %s\n", filename, strerror(errno));
if(remove(filename)) {
fprintf(stderr, "Error replacing file %s: %s\n", filename, strerror(errno));
@@
-2236,7
+2234,7
@@
static int cmd_init(int argc, char *argv[]) {
check_port(name);
check_port(name);
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
char filename[PATH_MAX];
snprintf(filename, sizeof(filename), "%s" SLASH "tinc-up", confbase);
char filename[PATH_MAX];
snprintf(filename, sizeof(filename), "%s" SLASH "tinc-up", confbase);
@@
-2398,7
+2396,7
@@
static int cmd_edit(int argc, char *argv[]) {
}
char *command;
}
char *command;
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
const char *editor = getenv("VISUAL");
if(!editor) {
const char *editor = getenv("VISUAL");
if(!editor) {
@@
-2625,7
+2623,7
@@
static int switch_network(char *name) {
}
if(fd >= 0) {
}
if(fd >= 0) {
- close(fd);
+ close
socket
(fd);
fd = -1;
}
fd = -1;
}
@@
-3292,7
+3290,7
@@
int main(int argc, char *argv[]) {
return 0;
}
return 0;
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
static struct WSAData wsa_state;
if(WSAStartup(MAKEWORD(2, 2), &wsa_state)) {
static struct WSAData wsa_state;
if(WSAStartup(MAKEWORD(2, 2), &wsa_state)) {