[Nagiosplug-checkins] CVS: nagiosplug/plugins check_nt.c,1.4,1.5
Ton Voon
tonvoon at users.sourceforge.net
Thu Jan 30 17:27:07 CET 2003
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv26386
Modified Files:
check_nt.c
Log Message:
Removed all unnecessary asprintf calls. Replaced with original check_nt.c
to minimise amount of changes (reported by Reuben Farrelly)
Index: check_nt.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_nt.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** check_nt.c 30 Jan 2003 23:18:59 -0000 1.4
--- check_nt.c 31 Jan 2003 01:26:40 -0000 1.5
***************
*** 98,102 ****
int uphours=0;
int upminutes=0;
! asprintf(&req_password,"None");
if(process_arguments(argc,argv)==ERROR)
--- 98,102 ----
int uphours=0;
int upminutes=0;
! req_password=strscpy(req_password,"None");
if(process_arguments(argc,argv)==ERROR)
***************
*** 111,119 ****
if (vars_to_check==CHECK_CLIENTVERSION) {
! asprintf(&send_buffer,strcat(req_password,"&1"));
result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
if(result!=STATE_OK)
return result;
! asprintf(&output_message,recv_buffer);
return_code=STATE_OK;
}
--- 111,119 ----
if (vars_to_check==CHECK_CLIENTVERSION) {
! send_buffer = strscpy(send_buffer,strcat(req_password,"&1"));
result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
if(result!=STATE_OK)
return result;
! output_message = strscpy(output_message,recv_buffer);
return_code=STATE_OK;
}
***************
*** 124,128 ****
// -l parameters is present with only integers
return_code=STATE_OK;
! asprintf(&temp_string,"CPU Load");
while (lvalue_list[0+offset]>0 && lvalue_list[0+offset]<=17280 &&
lvalue_list[1+offset]>=0 && lvalue_list[1+offset]<=100 &&
--- 124,128 ----
// -l parameters is present with only integers
return_code=STATE_OK;
! temp_string = strscpy(temp_string,"CPU Load");
while (lvalue_list[0+offset]>0 && lvalue_list[0+offset]<=17280 &&
lvalue_list[1+offset]>=0 && lvalue_list[1+offset]<=100 &&
***************
*** 150,154 ****
asprintf(&output_message," (%lu min. %lu%)",lvalue_list[0+offset], utilization);
! asprintf(&temp_string,"%s%s",temp_string,output_message);
offset+=3; //move accross the array
}
--- 150,154 ----
asprintf(&output_message," (%lu min. %lu%)",lvalue_list[0+offset], utilization);
! temp_string = strscat(temp_string,output_message);
offset+=3; //move accross the array
}
***************
*** 158,173 ****
}
else
! asprintf(&output_message,"%s","not enough values for -l parameters");
} else
! asprintf(&output_message,"wrong -l parameter.");
} else
! asprintf(&output_message,"missing -l parameters");
}
else if(vars_to_check==CHECK_UPTIME){
! asprintf(&send_buffer,strcat(req_password,"&3"));
result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
if(result!=STATE_OK)
--- 158,173 ----
}
else
! output_message = strscpy(output_message,"not enough values for -l parameters");
} else
! output_message = strscpy(output_message,"wrong -l parameter.");
} else
! output_message = strscpy(output_message,"missing -l parameters");
}
else if(vars_to_check==CHECK_UPTIME){
! send_buffer = strscpy(send_buffer,strcat(req_password,"&3"));
result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
if(result!=STATE_OK)
***************
*** 228,234 ****
}
else
! asprintf(&output_message,"wrong -l argument");
} else
! asprintf(&output_message,"missing -l parameters");
}
--- 228,234 ----
}
else
! output_message = strscpy(output_message,"wrong -l argument");
} else
! output_message = strscpy(output_message,"missing -l parameters");
}
***************
*** 253,257 ****
}
else
! asprintf(&output_message,"No service/process specified");
}
--- 253,257 ----
}
else
! output_message = strscpy(output_message,"No service/process specified");
}
***************
*** 327,331 ****
}
else {
! asprintf(&output_message,"No counter specified");
result=STATE_UNKNOWN;
}
--- 327,331 ----
}
else {
! output_message = strscpy(output_message,"No counter specified");
result=STATE_UNKNOWN;
}
***************
*** 370,374 ****
}
else {
! asprintf(&output_message,"No file specified");
result=STATE_UNKNOWN;
}
--- 370,374 ----
}
else {
! output_message = strscpy(output_message,"No file specified");
result=STATE_UNKNOWN;
}
***************
*** 450,454 ****
break;
case 's': /* password */
! asprintf(&req_password,optarg);
break;
case 'p': /* port */
--- 450,454 ----
break;
case 's': /* password */
! req_password=strscpy(req_password,optarg);
break;
case 'p': /* port */
***************
*** 483,487 ****
break;
case 'l': /* value list */
! asprintf(&value_list,optarg);
check_value_list=TRUE;
break;
--- 483,487 ----
break;
case 'l': /* value list */
! value_list=strscpy(value_list,optarg);
check_value_list=TRUE;
break;
More information about the Commits
mailing list