projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Log TAP-Windows driver version on startup.
[tinc]
/
src
/
process.c
diff --git
a/src/process.c
b/src/process.c
index
9f99a94
..
51bd902
100644
(file)
--- a/
src/process.c
+++ b/
src/process.c
@@
-42,6
+42,7
@@
bool sigalrm = false;
extern char **g_argv;
extern bool use_logfile;
extern char **g_argv;
extern bool use_logfile;
+extern bool use_syslog;
/* Some functions the less gifted operating systems might lack... */
/* Some functions the less gifted operating systems might lack... */
@@
-109,7
+110,7
@@
static bool install_service(void) {
return true;
}
return true;
}
-
static
io_t stop_io;
+io_t stop_io;
DWORD WINAPI controlhandler(DWORD request, DWORD type, LPVOID boe, LPVOID bah) {
switch(request) {
DWORD WINAPI controlhandler(DWORD request, DWORD type, LPVOID boe, LPVOID bah) {
switch(request) {
@@
-135,17
+136,9
@@
DWORD WINAPI controlhandler(DWORD request, DWORD type, LPVOID boe, LPVOID bah) {
return NO_ERROR;
}
return NO_ERROR;
}
-static void stop_handler(void *data, int flags) {
- event_exit();
-}
-
VOID WINAPI run_service(DWORD argc, LPTSTR* argv) {
extern int main2(int argc, char **argv);
VOID WINAPI run_service(DWORD argc, LPTSTR* argv) {
extern int main2(int argc, char **argv);
- io_add_event(&stop_io, stop_handler, NULL, WSACreateEvent());
- if (stop_io.event == FALSE)
- abort();
-
status.dwServiceType = SERVICE_WIN32;
status.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
status.dwWin32ExitCode = 0;
status.dwServiceType = SERVICE_WIN32;
status.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
status.dwWin32ExitCode = 0;
@@
-172,9
+165,6
@@
VOID WINAPI run_service(DWORD argc, LPTSTR* argv) {
SetServiceStatus(statushandle, &status);
}
SetServiceStatus(statushandle, &status);
}
- if (WSACloseEvent(stop_io.event) == FALSE)
- abort();
- io_del(&stop_io);
return;
}
return;
}
@@
-200,6
+190,8
@@
bool init_service(void) {
Detach from current terminal
*/
bool detach(void) {
Detach from current terminal
*/
bool detach(void) {
+ logmode_t logmode;
+
#ifndef HAVE_MINGW
signal(SIGPIPE, SIG_IGN);
signal(SIGUSR1, SIG_IGN);
#ifndef HAVE_MINGW
signal(SIGPIPE, SIG_IGN);
signal(SIGUSR1, SIG_IGN);
@@
-221,12
+213,17
@@
bool detach(void) {
#endif
}
#endif
}
- openlogger(identname, use_logfile?LOGMODE_FILE:(do_detach?LOGMODE_SYSLOG:LOGMODE_STDERR));
+ if(use_logfile)
+ logmode = LOGMODE_FILE;
+ else if(use_syslog || do_detach)
+ logmode = LOGMODE_SYSLOG;
+ else
+ logmode = LOGMODE_STDERR;
+
+ openlogger(identname, logmode);
logger(DEBUG_ALWAYS, LOG_NOTICE, "tincd %s (%s %s) starting, debug level %d",
logger(DEBUG_ALWAYS, LOG_NOTICE, "tincd %s (%s %s) starting, debug level %d",
-
BUILD_
VERSION, BUILD_DATE, BUILD_TIME, debug_level);
+ VERSION, BUILD_DATE, BUILD_TIME, debug_level);
return true;
}
return true;
}
-
-