projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Handle special characters in sptps_test only if the --special option is given.
[tinc]
/
src
/
process.c
diff --git
a/src/process.c
b/src/process.c
index
6135efb
..
5d78c29
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... */
@@
-189,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);
@@
-200,7
+203,7
@@
bool detach(void) {
if(do_detach) {
#ifndef HAVE_MINGW
if(do_detach) {
#ifndef HAVE_MINGW
- if(daemon(
0
, 0)) {
+ if(daemon(
1
, 0)) {
logger(DEBUG_ALWAYS, LOG_ERR, "Couldn't detach from terminal: %s", strerror(errno));
return false;
}
logger(DEBUG_ALWAYS, LOG_ERR, "Couldn't detach from terminal: %s", strerror(errno));
return false;
}
@@
-210,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",
BUILD_VERSION, BUILD_DATE, BUILD_TIME, debug_level);
return true;
}
logger(DEBUG_ALWAYS, LOG_NOTICE, "tincd %s (%s %s) starting, debug level %d",
BUILD_VERSION, BUILD_DATE, BUILD_TIME, debug_level);
return true;
}
-
-