projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix weight comparison in edge BFS
[tinc]
/
src
/
process.c
diff --git
a/src/process.c
b/src/process.c
index
c6cb536
..
5e7b1db
100644
(file)
--- a/
src/process.c
+++ b/
src/process.c
@@
-1,7
+1,7
@@
/*
process.c -- process management functions
Copyright (C) 1999-2005 Ivo Timmermans,
/*
process.c -- process management functions
Copyright (C) 1999-2005 Ivo Timmermans,
- 2000-201
3
Guus Sliepen <guus@tinc-vpn.org>
+ 2000-201
8
Guus Sliepen <guus@tinc-vpn.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-20,33
+20,29
@@
#include "system.h"
#include "system.h"
-#include "conf.h"
-#include "connection.h"
-#include "control.h"
-#include "device.h"
-#include "edge.h"
-#include "event.h"
#include "logger.h"
#include "names.h"
#include "logger.h"
#include "names.h"
-#include "net.h"
-#include "node.h"
#include "process.h"
#include "process.h"
-#include "subnet.h"
-#include "utils.h"
-#include "xalloc.h"
#include "version.h"
#include "version.h"
+#ifdef HAVE_WINDOWS
+#include "utils.h"
+#endif
+
/* If zero, don't detach from the terminal. */
bool do_detach = true;
/* If zero, don't detach from the terminal. */
bool do_detach = true;
-bool sigalrm = false;
extern char **g_argv;
extern char **g_argv;
-extern bool use_logfile;
-extern bool use_syslog;
+
+/* If nonzero, use syslog instead of stderr in no-detach mode. */
+bool use_syslog = false;
+
+/* If nonzero, write log entries to a separate file. */
+bool use_logfile = false;
/* Some functions the less gifted operating systems might lack... */
/* Some functions the less gifted operating systems might lack... */
-#ifdef HAVE_
MINGW
+#ifdef HAVE_
WINDOWS
static SC_HANDLE manager = NULL;
static SC_HANDLE service = NULL;
static SERVICE_STATUS status = {0};
static SC_HANDLE manager = NULL;
static SC_HANDLE service = NULL;
static SERVICE_STATUS status = {0};
@@
-54,7
+50,8
@@
static SERVICE_STATUS_HANDLE statushandle = 0;
static bool install_service(void) {
char command[4096] = "\"";
static bool install_service(void) {
char command[4096] = "\"";
- SERVICE_DESCRIPTION description = {"Virtual Private Network daemon"};
+ char description_buffer[] = "Virtual Private Network daemon";
+ SERVICE_DESCRIPTION description = {description_buffer};
manager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
manager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
@@
-115,7
+112,11
@@
static bool install_service(void) {
io_t stop_io;
io_t stop_io;
-DWORD WINAPI controlhandler(DWORD request, DWORD type, LPVOID boe, LPVOID bah) {
+static DWORD WINAPI controlhandler(DWORD request, DWORD type, LPVOID data, LPVOID context) {
+ (void)type;
+ (void)data;
+ (void)context;
+
switch(request) {
case SERVICE_CONTROL_INTERROGATE:
SetServiceStatus(statushandle, &status);
switch(request) {
case SERVICE_CONTROL_INTERROGATE:
SetServiceStatus(statushandle, &status);
@@
-145,7
+146,7
@@
DWORD WINAPI controlhandler(DWORD request, DWORD type, LPVOID boe, LPVOID bah) {
return NO_ERROR;
}
return NO_ERROR;
}
-VOID WINAPI run_service(DWORD argc, LPTSTR *argv) {
+
static
VOID WINAPI run_service(DWORD argc, LPTSTR *argv) {
extern int main2(int argc, char **argv);
status.dwServiceType = SERVICE_WIN32;
extern int main2(int argc, char **argv);
status.dwServiceType = SERVICE_WIN32;
@@
-201,7
+202,7
@@
bool init_service(void) {
bool detach(void) {
logmode_t logmode;
bool detach(void) {
logmode_t logmode;
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
signal(SIGPIPE, SIG_IGN);
signal(SIGUSR1, SIG_IGN);
signal(SIGUSR2, SIG_IGN);
signal(SIGPIPE, SIG_IGN);
signal(SIGUSR1, SIG_IGN);
signal(SIGUSR2, SIG_IGN);
@@
-211,7
+212,7
@@
bool detach(void) {
#endif
if(do_detach) {
#endif
if(do_detach) {
-#ifndef HAVE_
MINGW
+#ifndef HAVE_
WINDOWS
if(daemon(1, 0)) {
logger(DEBUG_ALWAYS, LOG_ERR, "Couldn't detach from terminal: %s", strerror(errno));
if(daemon(1, 0)) {
logger(DEBUG_ALWAYS, LOG_ERR, "Couldn't detach from terminal: %s", strerror(errno));