projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More checks for missing functions.
[tinc]
/
src
/
process.c
diff --git
a/src/process.c
b/src/process.c
index
218df76
..
36b2146
100644
(file)
--- a/
src/process.c
+++ b/
src/process.c
@@
-17,7
+17,7
@@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: process.c,v 1.1.2.5
7 2003/07/22 20:55:20
guus Exp $
+ $Id: process.c,v 1.1.2.5
8 2003/07/28 22:06:09
guus Exp $
*/
#include "system.h"
*/
#include "system.h"
@@
-88,6
+88,7
@@
void cleanup_and_exit(int c)
exit(c);
}
exit(c);
}
+#ifndef HAVE_MINGW
/*
check for an existing tinc for this net, and write pid to pidfile
*/
/*
check for an existing tinc for this net, and write pid to pidfile
*/
@@
-114,12
+115,14
@@
static bool write_pidfile(void)
return true;
}
return true;
}
+#endif
/*
kill older tincd for this net
*/
bool kill_other(int signal)
{
/*
kill older tincd for this net
*/
bool kill_other(int signal)
{
+#ifndef HAVE_MINGW
int pid;
cp();
int pid;
cp();
@@
-148,6
+151,7
@@
bool kill_other(int signal)
fprintf(stderr, _("Removing stale lock file.\n"));
remove_pid(pidfilename);
}
fprintf(stderr, _("Removing stale lock file.\n"));
remove_pid(pidfilename);
}
+#endif
return true;
}
return true;
}
@@
-163,13
+167,16
@@
bool detach(void)
/* First check if we can open a fresh new pidfile */
/* First check if we can open a fresh new pidfile */
+#ifndef HAVE_MINGW
if(!write_pidfile())
return false;
if(!write_pidfile())
return false;
+#endif
/* If we succeeded in doing that, detach */
closelogger();
/* If we succeeded in doing that, detach */
closelogger();
+#ifdef HAVE_FORK
if(do_detach) {
if(daemon(0, 0)) {
fprintf(stderr, _("Couldn't detach from terminal: %s"),
if(do_detach) {
if(daemon(0, 0)) {
fprintf(stderr, _("Couldn't detach from terminal: %s"),
@@
-182,6
+189,7
@@
bool detach(void)
if(!write_pid(pidfilename))
return false;
}
if(!write_pid(pidfilename))
return false;
}
+#endif
openlogger(identname, use_logfile?LOGMODE_FILE:(do_detach?LOGMODE_SYSLOG:LOGMODE_STDERR));
openlogger(identname, use_logfile?LOGMODE_FILE:(do_detach?LOGMODE_SYSLOG:LOGMODE_STDERR));
@@
-193,6
+201,7
@@
bool detach(void)
return true;
}
return true;
}
+#ifdef HAVE_FORK
/*
Execute the program name, with sane environment.
*/
/*
Execute the program name, with sane environment.
*/
@@
-224,12
+233,14
@@
static void _execute_script(const char *scriptname, char **envp)
strerror(save_errno));
exit(save_errno);
}
strerror(save_errno));
exit(save_errno);
}
+#endif
/*
Fork and execute the program pointed to by name.
*/
bool execute_script(const char *name, char **envp)
{
/*
Fork and execute the program pointed to by name.
*/
bool execute_script(const char *name, char **envp)
{
+#ifdef HAVE_FORK
pid_t pid;
int status;
struct stat s;
pid_t pid;
int status;
struct stat s;
@@
-287,6
+298,9
@@
bool execute_script(const char *name, char **envp)
/* Child here */
_execute_script(scriptname, envp);
/* Child here */
_execute_script(scriptname, envp);
+#else
+ return true;
+#endif
}
}
@@
-294,6
+308,7
@@
bool execute_script(const char *name, char **envp)
Signal handlers.
*/
Signal handlers.
*/
+#ifndef HAVE_MINGW
static RETSIGTYPE sigterm_handler(int a)
{
logger(LOG_NOTICE, _("Got TERM signal"));
static RETSIGTYPE sigterm_handler(int a)
{
logger(LOG_NOTICE, _("Got TERM signal"));
@@
-415,9
+430,11
@@
static struct {
{SIGWINCH, sigwinch_handler},
{0, NULL}
};
{SIGWINCH, sigwinch_handler},
{0, NULL}
};
+#endif
void setup_signals(void)
{
void setup_signals(void)
{
+#ifndef HAVE_MINGW
int i;
struct sigaction act;
int i;
struct sigaction act;
@@
-449,4
+466,5
@@
void setup_signals(void)
sighandlers[i].signal, strsignal(sighandlers[i].signal),
strerror(errno));
}
sighandlers[i].signal, strsignal(sighandlers[i].signal),
strerror(errno));
}
+#endif
}
}