[Nagiosplug-checkins] CVS: nagiosplug/plugins check_nt.c,1.5,1.6
Ton Voon
tonvoon at users.sourceforge.net
Fri Jan 31 10:37:02 CET 2003
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv20003
Modified Files:
check_nt.c
Log Message:
Reapply all asprintf calls. Fix for %% problem with -l flag.
Index: check_nt.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_nt.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** check_nt.c 31 Jan 2003 01:26:40 -0000 1.5
--- check_nt.c 31 Jan 2003 18:36:06 -0000 1.6
***************
*** 98,102 ****
int uphours=0;
int upminutes=0;
! req_password=strscpy(req_password,"None");
if(process_arguments(argc,argv)==ERROR)
--- 98,102 ----
int uphours=0;
int upminutes=0;
! asprintf(&req_password,"None");
if(process_arguments(argc,argv)==ERROR)
***************
*** 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;
}
--- 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;
}
***************
*** 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 &&
--- 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 &&
***************
*** 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
}
--- 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
}
***************
*** 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)
--- 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)
***************
*** 228,234 ****
}
else
! output_message = strscpy(output_message,"wrong -l argument");
} else
! output_message = strscpy(output_message,"missing -l parameters");
}
--- 228,234 ----
}
else
! asprintf(&output_message,"wrong -l argument");
} else
! asprintf(&output_message,"missing -l parameters");
}
***************
*** 253,257 ****
}
else
! output_message = strscpy(output_message,"No service/process specified");
}
--- 253,257 ----
}
else
! asprintf(&output_message,"No service/process specified");
}
***************
*** 327,331 ****
}
else {
! output_message = strscpy(output_message,"No counter specified");
result=STATE_UNKNOWN;
}
--- 327,331 ----
}
else {
! asprintf(&output_message,"No counter specified");
result=STATE_UNKNOWN;
}
***************
*** 370,374 ****
}
else {
! output_message = strscpy(output_message,"No file specified");
result=STATE_UNKNOWN;
}
--- 370,374 ----
}
else {
! asprintf(&output_message,"No file specified");
result=STATE_UNKNOWN;
}
***************
*** 450,454 ****
break;
case 's': /* password */
! req_password=strscpy(req_password,optarg);
break;
case 'p': /* port */
--- 450,454 ----
break;
case 's': /* password */
! asprintf(&req_password,optarg);
break;
case 'p': /* port */
***************
*** 483,487 ****
break;
case 'l': /* value list */
! value_list=strscpy(value_list,optarg);
check_value_list=TRUE;
break;
--- 483,487 ----
break;
case 'l': /* value list */
! asprintf(&value_list,"%s",optarg);
check_value_list=TRUE;
break;
More information about the Commits
mailing list