From b242d6df8c2d0566fe29c191797590dd5264aa6e Mon Sep 17 00:00:00 2001 From: z3APA3A <3APA3A@3proxy.ru> Date: Tue, 23 Aug 2016 14:19:27 +0300 Subject: [PATCH] Fix daemonize in *nix --- src/common.c | 7 +++++++ src/proxy.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/common.c b/src/common.c index b72cfb9..b6f4b86 100644 --- a/src/common.c +++ b/src/common.c @@ -17,6 +17,13 @@ int randomizer = 1; #ifndef _WIN32 pthread_attr_t pa; + + + void daemonize(void){ + if(fork()) exit(0); + else setsid(); + } + #endif unsigned char **stringtable = NULL; diff --git a/src/proxy.h b/src/proxy.h index 061cfff..7a1c530 100644 --- a/src/proxy.h +++ b/src/proxy.h @@ -104,7 +104,7 @@ #define PTHREAD_STACK_MIN 32768 #define sockerror strerror #endif -#define daemonize() {if(fork())exit(0); else setsid();} +void daemonize(void); #define SLEEPTIME 1000 #ifndef O_BINARY #define O_BINARY 0