Update of /cvsroot/nagios/nagios/common
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv21561/common
Modified Files:
Tag: nagios-2-x-bugfixes
comments.c
Log Message:
Bug fixes
Index: comments.c
===================================================================
RCS file: /cvsroot/nagios/nagios/common/comments.c,v
retrieving revision 1.17.2.1
retrieving revision 1.17.2.2
diff -C2 -d -r1.17.2.1 -r1.17.2.2
*** comments.c 21 Mar 2006 18:00:59 -0000 1.17.2.1
--- comments.c 9 Oct 2006 15:59:02 -0000 1.17.2.2
***************
*** 4,8 ****
*
* Copyright (c) 1999-2006 Ethan Galstad (nagios@xxxxxxxxxx)
! * Last Modified: 03-21-2006
*
* License:
--- 4,8 ----
*
* Copyright (c) 1999-2006 Ethan Galstad (nagios@xxxxxxxxxx)
! * Last Modified: 10-09-2006
*
* License:
***************
*** 59,63 ****
/* initializes comment data */
int initialize_comment_data(char *config_file){
! int result;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
--- 59,63 ----
/* initializes comment data */
int initialize_comment_data(char *config_file){
! int result=OK;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
***************
*** 72,76 ****
/* removes old/invalid comments */
int cleanup_comment_data(char *config_file){
! int result;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
--- 72,76 ----
/* removes old/invalid comments */
int cleanup_comment_data(char *config_file){
! int result=OK;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
***************
*** 91,96 ****
/* adds a new host or service comment */
int add_new_comment(int type, int entry_type, char *host_name, char
*svc_description, time_t entry_time, char *author_name, char *comment_data, int
persistent, int source, int expires, time_t expire_time, unsigned long
*comment_id){
! int result;
! unsigned long new_comment_id;
if(type==HOST_COMMENT)
--- 91,96 ----
/* adds a new host or service comment */
int add_new_comment(int type, int entry_type, char *host_name, char
*svc_description, time_t entry_time, char *author_name, char *comment_data, int
persistent, int source, int expires, time_t expire_time, unsigned long
*comment_id){
! int result=OK;
! unsigned long new_comment_id=0L;
if(type==HOST_COMMENT)
***************
*** 113,118 ****
/* adds a new host comment */
int add_new_host_comment(int entry_type, char *host_name, time_t entry_time,
char *author_name, char *comment_data, int persistent, int source, int expires,
time_t expire_time, unsigned long *comment_id){
! int result;
! unsigned long new_comment_id;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
--- 113,118 ----
/* adds a new host comment */
int add_new_host_comment(int entry_type, char *host_name, time_t entry_time,
char *author_name, char *comment_data, int persistent, int source, int expires,
time_t expire_time, unsigned long *comment_id){
! int result=OK;
! unsigned long new_comment_id=0L;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
***************
*** 136,141 ****
/* adds a new service comment */
int add_new_service_comment(int entry_type, char *host_name, char
*svc_description, time_t entry_time, char *author_name, char *comment_data, int
persistent, int source, int expires, time_t expire_time, unsigned long
*comment_id){
! int result;
! unsigned long new_comment_id;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
--- 136,141 ----
/* adds a new service comment */
int add_new_service_comment(int entry_type, char *host_name, char
*svc_description, time_t entry_time, char *author_name, char *comment_data, int
persistent, int source, int expires, time_t expire_time, unsigned long
*comment_id){
! int result=OK;
! unsigned long new_comment_id=0L;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
***************
*** 165,173 ****
/* deletes a host or service comment */
int delete_comment(int type, unsigned long comment_id){
! int result;
comment *this_comment=NULL;
comment *last_comment=NULL;
comment *next_comment=NULL;
! int hashslot;
comment *this_hash=NULL;
comment *last_hash=NULL;
--- 165,173 ----
/* deletes a host or service comment */
int delete_comment(int type, unsigned long comment_id){
! int result=OK;
comment *this_comment=NULL;
comment *last_comment=NULL;
comment *next_comment=NULL;
! int hashslot=0;
comment *this_hash=NULL;
comment *last_hash=NULL;
***************
*** 238,245 ****
/* deletes a host comment */
int delete_host_comment(unsigned long comment_id){
! int result;
/* delete the comment from memory */
! delete_comment(HOST_COMMENT,comment_id);
return result;
--- 238,245 ----
/* deletes a host comment */
int delete_host_comment(unsigned long comment_id){
! int result=OK;
/* delete the comment from memory */
! result=delete_comment(HOST_COMMENT,comment_id);
return result;
***************
*** 250,257 ****
/* deletes a service comment */
int delete_service_comment(unsigned long comment_id){
! int result;
/* delete the comment from memory */
! delete_comment(SERVICE_COMMENT,comment_id);
return result;
--- 250,257 ----
/* deletes a service comment */
int delete_service_comment(unsigned long comment_id){
! int result=OK;
/* delete the comment from memory */
! result=delete_comment(SERVICE_COMMENT,comment_id);
return result;
***************
*** 261,265 ****
/* deletes all comments for a particular host or service */
int delete_all_comments(int type, char *host_name, char *svc_description){
! int result;
if(type==HOST_COMMENT)
--- 261,265 ----
/* deletes all comments for a particular host or service */
int delete_all_comments(int type, char *host_name, char *svc_description){
! int result=OK;
if(type==HOST_COMMENT)
***************
*** 274,278 ****
/* deletes all comments for a particular host */
int delete_all_host_comments(char *host_name){
! int result;
comment *temp_comment=NULL;
--- 274,278 ----
/* deletes all comments for a particular host */
int delete_all_host_comments(char *host_name){
! int result=OK;
comment *temp_comment=NULL;
***************
*** 297,301 ****
/* deletes all comments for a particular service */
int delete_all_service_comments(char *host_name, char *svc_description){
! int result;
comment *temp_comment=NULL;
comment *next_comment=NULL;
--- 297,301 ----
/* deletes all comments for a particular service */
int delete_all_service_comments(char *host_name, char *svc_description){
! int result=OK;
comment *temp_comment=NULL;
comment *next_comment=NULL;
***************
*** 328,332 ****
/* checks for an expired comment (and removes it) */
int check_for_expired_comment(unsigned long comment_id){
! comment *temp_comment;
/* check all comments */
--- 328,332 ----
/* checks for an expired comment (and removes it) */
int check_for_expired_comment(unsigned long comment_id){
! comment *temp_comment=NULL;
/* check all comments */
***************
*** 355,359 ****
int read_comment_data(char *main_config_file){
! int result;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
--- 355,359 ----
int read_comment_data(char *main_config_file){
! int result=OK;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
***************
*** 373,378 ****
/* adds comment to hash list in memory */
int add_comment_to_hashlist(comment *new_comment){
! comment *temp_comment, *lastpointer;
! int hashslot;
/* initialize hash list */
--- 373,379 ----
/* adds comment to hash list in memory */
int add_comment_to_hashlist(comment *new_comment){
! comment *temp_comment=NULL;
! comment *lastpointer=NULL;
! int hashslot=0;
/* initialize hash list */
***************
*** 418,422 ****
/* adds a host comment to the list in memory */
int add_host_comment(int entry_type, char *host_name, time_t entry_time, char
*author, char *comment_data, unsigned long comment_id, int persistent, int
expires, time_t expire_time, int source){
! int result;
result=add_comment(HOST_COMMENT,entry_type,host_name,NULL,entry_time,author,comment_data,comment_id,persistent,expires,expire_time,source);
--- 419,423 ----
/* adds a host comment to the list in memory */
int add_host_comment(int entry_type, char *host_name, time_t entry_time, char
*author, char *comment_data, unsigned long comment_id, int persistent, int
expires, time_t expire_time, int source){
! int result=OK;
result=add_comment(HOST_COMMENT,entry_type,host_name,NULL,entry_time,author,comment_data,comment_id,persistent,expires,expire_time,source);
***************
*** 429,433 ****
/* adds a service comment to the list in memory */
int add_service_comment(int entry_type, char *host_name, char
*svc_description, time_t entry_time, char *author, char *comment_data, unsigned
long comment_id, int persistent, int expires, time_t expire_time, int source){
! int result;
result=add_comment(SERVICE_COMMENT,entry_type,host_name,svc_description,entry_time,author,comment_data,comment_id,persistent,expires,expire_time,source);
--- 430,434 ----
/* adds a service comment to the list in memory */
int add_service_comment(int entry_type, char *host_name, char
*svc_description, time_t entry_time, char *author, char *comment_data, unsigned
long comment_id, int persistent, int expires, time_t expire_time, int source){
! int result=OK;
result=add_comment(SERVICE_COMMENT,entry_type,host_name,svc_description,entry_time,author,comment_data,comment_id,persistent,expires,expire_time,source);
***************
*** 547,552 ****
/* frees memory allocated for the comment data */
void free_comment_data(void){
! comment *this_comment;
! comment *next_comment;
/* free memory for the comment list */
--- 548,553 ----
/* frees memory allocated for the comment data */
void free_comment_data(void){
! comment *this_comment=NULL;
! comment *next_comment=NULL;
/* free memory for the comment list */
***************
*** 577,581 ****
/* get the number of comments associated with a particular host */
int number_of_host_comments(char *host_name){
! comment *temp_comment;
int total_comments=0;
--- 578,582 ----
/* get the number of comments associated with a particular host */
int number_of_host_comments(char *host_name){
! comment *temp_comment=NULL;
int total_comments=0;
***************
*** 594,598 ****
/* get the number of comments associated with a particular service */
int number_of_service_comments(char *host_name, char *svc_description){
! comment *temp_comment;
int total_comments=0;
--- 595,599 ----
/* get the number of comments associated with a particular service */
int number_of_service_comments(char *host_name, char *svc_description){
! comment *temp_comment=NULL;
int total_comments=0;
***************
*** 661,665 ****
/* find a comment by id */
comment *find_comment(unsigned long comment_id, int comment_type){
! comment *temp_comment;
for(temp_comment=comment_list;temp_comment!=NULL;temp_comment=temp_comment->next){
--- 662,666 ----
/* find a comment by id */
comment *find_comment(unsigned long comment_id, int comment_type){
! comment *temp_comment=NULL;
for(temp_comment=comment_list;temp_comment!=NULL;temp_comment=temp_comment->next){
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
|