Fix daemonize in *nix

This commit is contained in:
z3APA3A 2016-08-23 14:19:27 +03:00
parent 4e4f71712d
commit b242d6df8c
2 changed files with 8 additions and 1 deletions

View File

@ -17,6 +17,13 @@ int randomizer = 1;
#ifndef _WIN32 #ifndef _WIN32
pthread_attr_t pa; pthread_attr_t pa;
void daemonize(void){
if(fork()) exit(0);
else setsid();
}
#endif #endif
unsigned char **stringtable = NULL; unsigned char **stringtable = NULL;

View File

@ -104,7 +104,7 @@
#define PTHREAD_STACK_MIN 32768 #define PTHREAD_STACK_MIN 32768
#define sockerror strerror #define sockerror strerror
#endif #endif
#define daemonize() {if(fork())exit(0); else setsid();} void daemonize(void);
#define SLEEPTIME 1000 #define SLEEPTIME 1000
#ifndef O_BINARY #ifndef O_BINARY
#define O_BINARY 0 #define O_BINARY 0