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.57 2003/07/22 20:55:20 guus Exp $
+ $Id: process.c,v 1.1.2.59 2003/07/30 21:52:41 guus Exp $
*/
#include "system.h"
exit(c);
}
+#ifndef HAVE_MINGW
/*
check for an existing tinc for this net, and write pid to pidfile
*/
return true;
}
+#endif
/*
kill older tincd for this net
*/
bool kill_other(int signal)
{
+#ifndef HAVE_MINGW
int pid;
cp();
fprintf(stderr, _("Removing stale lock file.\n"));
remove_pid(pidfilename);
}
+#endif
return true;
}
/* First check if we can open a fresh new pidfile */
+#ifndef HAVE_MINGW
if(!write_pidfile())
return false;
+#endif
/* 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(!write_pid(pidfilename))
return false;
}
+#endif
openlogger(identname, use_logfile?LOGMODE_FILE:(do_detach?LOGMODE_SYSLOG:LOGMODE_STDERR));
return true;
}
+#ifdef HAVE_FORK
/*
Execute the program name, with sane environment.
*/
static void _execute_script(const char *scriptname, char **envp)
- __attribute__ ((noreturn));
+ __attribute__ ((__noreturn__));
static void _execute_script(const char *scriptname, char **envp)
{
int 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)
{
+#ifdef HAVE_FORK
pid_t pid;
int status;
struct stat s;
/* Child here */
_execute_script(scriptname, envp);
+#else
+ return true;
+#endif
}
Signal handlers.
*/
+#ifndef HAVE_MINGW
static RETSIGTYPE sigterm_handler(int a)
{
logger(LOG_NOTICE, _("Got TERM signal"));
{SIGWINCH, sigwinch_handler},
{0, NULL}
};
+#endif
void setup_signals(void)
{
+#ifndef HAVE_MINGW
int i;
struct sigaction act;
sighandlers[i].signal, strsignal(sighandlers[i].signal),
strerror(errno));
}
+#endif
}