summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d0df392)
raw | patch | inline | side by side (parent: d0df392)
author | Ton Voon <tonvoon@users.sourceforge.net> | |
Fri, 31 Jan 2003 01:26:40 +0000 (01:26 +0000) | ||
committer | Ton Voon <tonvoon@users.sourceforge.net> | |
Fri, 31 Jan 2003 01:26:40 +0000 (01:26 +0000) |
to minimise amount of changes (reported by Reuben Farrelly)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@275 f882894a-f735-0410-b71e-b25c423dba1c
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@275 f882894a-f735-0410-b71e-b25c423dba1c
plugins/check_nt.c | patch | blob | history |
diff --git a/plugins/check_nt.c b/plugins/check_nt.c
index 4d43f545f45f8f0b7530f8ff761a9c3aeb63b58c..32c180f6f58c45b8475ff1b5a0b335cd9174c3c2 100644 (file)
--- a/plugins/check_nt.c
+++ b/plugins/check_nt.c
int updays=0;
int uphours=0;
int upminutes=0;
- asprintf(&req_password,"None");
+ req_password=strscpy(req_password,"None");
if(process_arguments(argc,argv)==ERROR)
usage("Could not parse arguments\n");
if (vars_to_check==CHECK_CLIENTVERSION) {
- asprintf(&send_buffer,strcat(req_password,"&1"));
+ 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;
- asprintf(&output_message,recv_buffer);
+ output_message = strscpy(output_message,recv_buffer);
return_code=STATE_OK;
}
else if(vars_to_check==CHECK_CPULOAD){
if (strtolarray(&lvalue_list,value_list,",")==TRUE) {
// -l parameters is present with only integers
return_code=STATE_OK;
- asprintf(&temp_string,"CPU Load");
+ 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 &&
lvalue_list[2+offset]>=0 && lvalue_list[2+offset]<=100) {
return_code=STATE_WARNING;
asprintf(&output_message," (%lu min. %lu%)",lvalue_list[0+offset], utilization);
- asprintf(&temp_string,"%s%s",temp_string,output_message);
+ temp_string = strscat(temp_string,output_message);
offset+=3; //move accross the array
}
if (strlen(temp_string)>10) {
asprintf(&output_message,"%s",temp_string);
}
else
- asprintf(&output_message,"%s","not enough values for -l parameters");
+ output_message = strscpy(output_message,"not enough values for -l parameters");
} else
- asprintf(&output_message,"wrong -l parameter.");
+ output_message = strscpy(output_message,"wrong -l parameter.");
} else
- asprintf(&output_message,"missing -l parameters");
+ output_message = strscpy(output_message,"missing -l parameters");
}
else if(vars_to_check==CHECK_UPTIME){
- asprintf(&send_buffer,strcat(req_password,"&3"));
+ 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)
return result;
}
}
else
- asprintf(&output_message,"wrong -l argument");
+ output_message = strscpy(output_message,"wrong -l argument");
} else
- asprintf(&output_message,"missing -l parameters");
+ output_message = strscpy(output_message,"missing -l parameters");
}
asprintf(&output_message, "%s",temp_string);
}
else
- asprintf(&output_message,"No service/process specified");
+ output_message = strscpy(output_message,"No service/process specified");
}
else if(vars_to_check==CHECK_MEMUSE) {
}
else {
- asprintf(&output_message,"No counter specified");
+ output_message = strscpy(output_message,"No counter specified");
result=STATE_UNKNOWN;
}
}
}
else {
- asprintf(&output_message,"No file specified");
+ output_message = strscpy(output_message,"No file specified");
result=STATE_UNKNOWN;
}
}
server_address=optarg;
break;
case 's': /* password */
- asprintf(&req_password,optarg);
+ req_password=strscpy(req_password,optarg);
break;
case 'p': /* port */
if (is_intnonneg(optarg))
return ERROR;
break;
case 'l': /* value list */
- asprintf(&value_list,optarg);
+ value_list=strscpy(value_list,optarg);
check_value_list=TRUE;
break;
case 'w': /* warning threshold */