projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Reduce duplication in request handler tables
[tinc]
/
src
/
tincd.c
diff --git
a/src/tincd.c
b/src/tincd.c
index
7c30a26
..
9850eeb
100644
(file)
--- a/
src/tincd.c
+++ b/
src/tincd.c
@@
-33,11
+33,11
@@
#include LZO1X_H
#endif
#include LZO1X_H
#endif
-#ifdef
LZ4_H
-#include
LZ4_H
+#ifdef
HAVE_LZ4
+#include
<lz4.h>
#endif
#endif
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
#include <pwd.h>
#include <grp.h>
#include <time.h>
#include <pwd.h>
#include <grp.h>
#include <time.h>
@@
-61,15
+61,12
@@
static bool show_help = false;
/* If nonzero, print the version on standard output and exit. */
static bool show_version = false;
/* If nonzero, print the version on standard output and exit. */
static bool show_version = false;
-/* If nonzero, use null ciphers and skip all key exchanges. */
-bool bypass_security = false;
-
#ifdef HAVE_MLOCKALL
/* If nonzero, disable swapping for this process. */
static bool do_mlock = false;
#endif
#ifdef HAVE_MLOCKALL
/* If nonzero, disable swapping for this process. */
static bool do_mlock = false;
#endif
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
/* If nonzero, chroot to netdir after startup. */
static bool do_chroot = false;
/* If nonzero, chroot to netdir after startup. */
static bool do_chroot = false;
@@
-77,12
+74,6
@@
static bool do_chroot = false;
static const char *switchuser = NULL;
#endif
static const char *switchuser = NULL;
#endif
-/* If nonzero, write log entries to a separate file. */
-bool use_logfile = false;
-
-/* If nonzero, use syslog instead of stderr in no-detach mode. */
-bool use_syslog = false;
-
char **g_argv; /* a copy of the cmdline arguments */
static int status = 1;
char **g_argv; /* a copy of the cmdline arguments */
static int status = 1;
@@
-105,7
+96,7
@@
static struct option const long_options[] = {
{NULL, 0, NULL, 0}
};
{NULL, 0, NULL, 0}
};
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
static struct WSAData wsa_state;
int main2(int argc, char **argv);
#endif
static struct WSAData wsa_state;
int main2(int argc, char **argv);
#endif
@@
-130,7
+121,7
@@
static void usage(bool status) {
" --pidfile=FILENAME Write PID and control socket cookie to FILENAME.\n"
" --bypass-security Disables meta protocol security, for debugging.\n"
" -o, --option[HOST.]KEY=VALUE Set global/host configuration value.\n"
" --pidfile=FILENAME Write PID and control socket cookie to FILENAME.\n"
" --bypass-security Disables meta protocol security, for debugging.\n"
" -o, --option[HOST.]KEY=VALUE Set global/host configuration value.\n"
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
" -R, --chroot chroot to NET dir at startup.\n"
" -U, --user=USER setuid to given USER at startup.\n"
#endif
" -R, --chroot chroot to NET dir at startup.\n"
" -U, --user=USER setuid to given USER at startup.\n"
#endif
@@
-205,7
+196,7
@@
static bool parse_options(int argc, char **argv) {
list_insert_tail(&cmdline_conf, cfg);
break;
list_insert_tail(&cmdline_conf, cfg);
break;
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
case 'R':
case 'U':
case 'R':
case 'U':
@@
-298,7
+289,7
@@
exit_fail:
}
static bool drop_privs(void) {
}
static bool drop_privs(void) {
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
uid_t uid = 0;
if(switchuser) {
uid_t uid = 0;
if(switchuser) {
@@
-351,7
+342,7
@@
static bool drop_privs(void) {
return true;
}
return true;
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
# define setpriority(level) !SetPriorityClass(GetCurrentProcess(), (level))
static void stop_handler(void *data, int flags) {
# define setpriority(level) !SetPriorityClass(GetCurrentProcess(), (level))
static void stop_handler(void *data, int flags) {
@@
-454,7
+445,7
@@
int main(int argc, char **argv) {
return 1;
}
return 1;
}
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
if(WSAStartup(MAKEWORD(2, 2), &wsa_state)) {
logger(DEBUG_ALWAYS, LOG_ERR, "System call `%s' failed: %s", "WSAStartup", winerror(GetLastError()));
if(WSAStartup(MAKEWORD(2, 2), &wsa_state)) {
logger(DEBUG_ALWAYS, LOG_ERR, "System call `%s' failed: %s", "WSAStartup", winerror(GetLastError()));
@@
-520,7
+511,7
@@
int main(int argc, char **argv) {
#endif
#endif
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
io_add_event(&stop_io, stop_handler, NULL, WSACreateEvent());
if(stop_io.event == FALSE) {
io_add_event(&stop_io, stop_handler, NULL, WSACreateEvent());
if(stop_io.event == FALSE) {