From bbde600decc1970f1507828fce5ba22c0948519b Mon Sep 17 00:00:00 2001 From: osmiy Date: Thu, 21 Dec 2006 10:01:27 +0000 Subject: - fixed printing of stdout/stderr (Eugene) git-svn-id: svn://svn.zabbix.com/trunk@3622 97f52cf1-0a1b-0410-bd0e-c28be96e8082 --- src/libs/zbxnix/daemon.c | 24 +++++++++++++++--------- src/libs/zbxsys/threads.c | 27 ++++++++++++++++++++++++++- src/libs/zbxsysinfo/common/common.c | 4 ++-- src/zabbix_server/alerter/alerter.c | 2 +- src/zabbix_server/server.c | 5 +++-- src/zabbix_server/trapper/trapper.c | 2 +- 6 files changed, 48 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/libs/zbxnix/daemon.c b/src/libs/zbxnix/daemon.c index 74b80030..3b111be1 100644 --- a/src/libs/zbxnix/daemon.c +++ b/src/libs/zbxnix/daemon.c @@ -21,6 +21,7 @@ #include "daemon.h" #include "pid.h" +#include "cfg.h" #include "log.h" char *APP_PID_FILE = NULL; @@ -116,7 +117,7 @@ int daemon_start(int allow_root) } - if( (pid = fork()) != 0 ) + if( (pid = zbx_fork()) != 0 ) { exit( 0 ); } @@ -125,7 +126,7 @@ int daemon_start(int allow_root) signal( SIGHUP, SIG_IGN ); - if( (pid = fork()) !=0 ) + if( (pid = zbx_fork()) !=0 ) { exit( 0 ); } @@ -133,14 +134,19 @@ int daemon_start(int allow_root) chdir("/"); umask(0002); - for(i=0; isendto,alert->subject,alert->message,(char *)0))*/ - pid=fork(); + pid = zbx_fork(); if(0 != pid) { waitpid(pid,NULL,0); diff --git a/src/zabbix_server/server.c b/src/zabbix_server/server.c index 0e5d7463..1367d744 100644 --- a/src/zabbix_server/server.c +++ b/src/zabbix_server/server.c @@ -337,7 +337,7 @@ void test() for(k = 0; k < 10; k++) { - switch(fork()) + switch( zbx_fork() ) { case -1: SDI("FORK - FAIL"); exit(1); break; case 0: @@ -501,6 +501,7 @@ int main(int argc, char **argv) } zabbix_log( LOG_LEVEL_WARNING, "Starting zabbix_server. ZABBIX %s.", ZABBIX_VERSION); + test(); return 0; #endif /* TEST */ @@ -578,7 +579,7 @@ int MAIN_ZABBIX_ENTRY(void) for(i=1; i<=CONFIG_POLLER_FORKS+CONFIG_TRAPPERD_FORKS+CONFIG_PINGER_FORKS+CONFIG_ALERTER_FORKS+CONFIG_HOUSEKEEPER_FORKS+CONFIG_TIMER_FORKS+CONFIG_UNREACHABLE_POLLER_FORKS+CONFIG_NODEWATCHER_FORKS; i++) { - if((pid = fork()) == 0) + if((pid = zbx_fork()) == 0) { server_num = i; break; diff --git a/src/zabbix_server/trapper/trapper.c b/src/zabbix_server/trapper/trapper.c index a0ffc4ee..278a1213 100644 --- a/src/zabbix_server/trapper/trapper.c +++ b/src/zabbix_server/trapper/trapper.c @@ -344,7 +344,7 @@ pid_t child_trapper_make(int i,int listenfd, int addrlen) { pid_t pid; - if((pid = fork()) >0) + if((pid = zbx_fork()) >0) { return (pid); } -- cgit