Revision: 1837
http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=1837&view=rev
Author: dermoth
Date: 2007-11-27 05:52:38 -0800 (Tue, 27 Nov 2007)
Log Message:
-----------
Safer handling of te data pointer...
Modified Paths:
--------------
nagiosplug/branches/dermoth_ntp_rework/plugins/check_ntp_peer.c
Modified: nagiosplug/branches/dermoth_ntp_rework/plugins/check_ntp_peer.c
===================================================================
--- nagiosplug/branches/dermoth_ntp_rework/plugins/check_ntp_peer.c 2007-11-26 10:34:43 UTC (rev 1836)
+++ nagiosplug/branches/dermoth_ntp_rework/plugins/check_ntp_peer.c 2007-11-27 13:52:38 UTC (rev 1837)
@@ -218,7 +218,7 @@
* the return value of the function.
* status is pretty much useless as syncsource_found is a global variable
* used later in main to check is the server was synchronized. It works
- * so I left it alone, but it can be repurposed if needed */
+ * so I left it alone */
int ntp_request(const char *host, double *offset, int *offset_result, double *jitter, int *stratum){
int conn=-1, i, npeers=0, num_candidates=0;
double tmp_offset = 0;
@@ -228,8 +228,7 @@
ntp_assoc_status_pair *peers=NULL;
ntp_control_message req;
const char *getvar = "stratum,offset,jitter";
- char *data="";
- char *value=NULL, *nptr=NULL;
+ char *data=NULL, *value=NULL, *nptr=NULL;
void *tmp;
status = STATE_OK;
@@ -303,7 +302,7 @@
/* If there's no sync.peer, query all candidates and use the best one */
if (PEER_SEL(peers[i].status) >= min_peer_sel){
if(verbose) printf("Getting offset, jitter and stratum for peer %.2x\n", ntohs(peers[i].assoc));
- data = "\0";
+ asprintf(&data, "");
do{
setup_control_request(&req, OP_READVAR, 2);
req.assoc = peers[i].assoc;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.