projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Do not use the C library's daemon() call.
[tinc]
/
src
/
process.c
diff --git
a/src/process.c
b/src/process.c
index
8fad5b0
..
33828bb
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.1
1 2000/11/22 22:05:37 guus
Exp $
+ $Id: process.c,v 1.1.2.1
3 2000/11/24 12:44:39 zarq
Exp $
*/
#include "config.h"
*/
#include "config.h"
@@
-42,6
+42,8
@@
#include "conf.h"
#include "process.h"
#include "conf.h"
#include "process.h"
+#include "subnet.h"
+#include "connection.h"
#include "system.h"
#include "system.h"
@@
-85,8
+87,7
@@
int fcloseall(void)
}
#endif
}
#endif
-#ifndef HAVE_DAEMON
-int daemon(int nochdir, int noclose)
+int become_daemon(void)
{
pid_t pid;
int fd;
{
pid_t pid;
int fd;
@@
-120,13
+121,9
@@
int daemon(int nochdir, int noclose)
kill(ppid, SIGTERM);
kill(ppid, SIGTERM);
- if(!nochdir)
- chdir("/");
-
- if(!noclose)
- fcloseall();
+ chdir("/");
+ fcloseall();
}
}
-#endif
/*
Close network connections, and terminate neatly
/*
Close network connections, and terminate neatly
@@
-199,13
+196,12
@@
cp
*/
int detach(void)
{
*/
int detach(void)
{
- int fd;
- pid_t pid;
cp
setup_signals();
if(do_detach)
cp
setup_signals();
if(do_detach)
- daemon(0, 0);
+ if(become_daemon() < 0)
+ return -1;
if(write_pidfile())
return -1;
if(write_pidfile())
return -1;