[icinga-checkins] icinga.org: icinga-core/mfriedrich/more-rdbms: add more debugoutput for daemon

git at icinga.org git at icinga.org
Sat Oct 10 19:51:30 CEST 2009


Module: icinga-core
Branch: mfriedrich/more-rdbms
Commit: 894f1afa5e31509df02bf27a449a3d31c17d7107
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=894f1afa5e31509df02bf27a449a3d31c17d7107

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Sat Oct 10 19:51:04 2009 +0200

add more debugoutput for daemon

---

 module/idoutils/src/ido2db.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/module/idoutils/src/ido2db.c b/module/idoutils/src/ido2db.c
index 413197e..8f61b8b 100644
--- a/module/idoutils/src/ido2db.c
+++ b/module/idoutils/src/ido2db.c
@@ -650,33 +650,38 @@ int ndo2db_daemonize(void){
 	/* fork */
 	if((pid=fork())<0){
 		perror("Fork error");
+		ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2, "ndo2db_daemonize() parent fork error\n");
 		ndo2db_cleanup_socket();
 		return NDO_ERROR;
 	        }
 
 	/* parent process goes away... */
 	else if((int)pid!=0){
+		ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2, "ndo2db_daemonize() parent process goes away\n");
 		ndo2db_free_program_memory();
 		exit(0);
 		}
 
 	/* child forks again... */
 	else{
+		ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2, "ndo2db_daemonize() child forks again\n");
 
 		if((pid=fork())<0){
 			perror("Fork error");
+			ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2, "ndo2db_daemonize() child fork error\n");
 			ndo2db_cleanup_socket();
 			return NDO_ERROR;
 	                }
 
 		/* first child process goes away.. */
 		else if((int)pid!=0){
+			ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2, "ndo2db_daemonize() first child process goes away\n");
 			ndo2db_free_program_memory();
 			exit(0);
 			}
 
 		/* grandchild continues... */
-
+		ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2, "ndo2db_daemonize() grandchild continues and  becomes session leader\n");
 		/* grandchild becomes session leader... */
 		setsid();
 	        }
@@ -706,7 +711,7 @@ int ndo2db_daemonize(void){
 		open("/dev/null",O_WRONLY);
 	open("/dev/null",O_WRONLY);
 
-	ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2, "ndo2db_drop_privileges() end\n");
+	ndo2db_log_debug_info(NDO2DB_DEBUGL_PROCESSINFO, 2, "ndo2db_daemonize() end\n");
 
 	return NDO_OK;
         }





More information about the icinga-checkins mailing list