projects
/
oweals
/
tinc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- Use only one socket for all UDP traffic (for compatibility)
[oweals/tinc.git]
/
src
/
process.c
diff --git
a/src/process.c
b/src/process.c
index 1319c0c0b90881f0aa6188f64705efaa58f4667e..5aaf573f2d20c8e177052076a61ba2a7689b16be 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
4 2000/11/24 23:13:05
guus Exp $
+ $Id: process.c,v 1.1.2.1
5 2000/11/25 13:33:33
guus Exp $
*/
#include "config.h"
*/
#include "config.h"
@@
-150,12
+150,23
@@
int detach(void)
cp
setup_signals();
cp
setup_signals();
+ /* First check if we can open a fresh new pidfile */
+
if(write_pidfile())
return -1;
if(write_pidfile())
return -1;
+ /* If we succeeded in doing that, detach */
+
if(do_detach)
if(do_detach)
- if(daemon(0, 0) < 0)
- return -1;
+ {
+ if(daemon(0, 0) < 0)
+ return -1;
+
+ /* Now UPDATE the pid in the pidfile, because we changed it... */
+
+ if(!write_pid(pidfilename))
+ return 1;
+ }
openlog(identname, LOG_CONS | LOG_PID, LOG_DAEMON);
openlog(identname, LOG_CONS | LOG_PID, LOG_DAEMON);
@@
-177,11
+188,8
@@
cp
void _execute_script(const char *name) __attribute__ ((noreturn));
void _execute_script(const char *name)
{
void _execute_script(const char *name) __attribute__ ((noreturn));
void _execute_script(const char *name)
{
- int error = 0;
char *scriptname;
char *s;
char *scriptname;
char *s;
- int fd;
-
cp
if(netname)
{
cp
if(netname)
{