Revision: 1839
http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=1839&view=rev
Author: dermoth
Date: 2007-12-04 03:18:40 -0800 (Tue, 04 Dec 2007)
Log Message:
-----------
Small cleanups
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-12-04 11:14:36 UTC (rev 1838)
+++ nagiosplug/branches/dermoth_ntp_rework/plugins/check_ntp_peer.c 2007-12-04 11:18:40 UTC (rev 1839)
@@ -228,7 +228,7 @@
ntp_assoc_status_pair *peers=NULL;
ntp_control_message req;
const char *getvar = "stratum,offset,jitter";
- char *data=NULL, *value=NULL, *nptr=NULL;
+ char *data, *value, *nptr;
void *tmp;
status = STATE_OK;
@@ -350,6 +350,7 @@
printf("parsing offset from peer %.2x: ", ntohs(peers[i].assoc));
value = extract_value(data, "offset");
+ nptr=NULL;
/* Convert the value if we have one */
if(value != NULL)
tmp_offset = strtod(value, &nptr) / 1000;
@@ -373,12 +374,13 @@
printf("parsing %s from peer %.2x: ", strstr(getvar, "dispersion") != NULL ? "dispersion" : "jitter", ntohs(peers[i].assoc));
}
value = extract_value(data, strstr(getvar, "dispersion") != NULL ? "dispersion" : "jitter");
+ nptr=NULL;
/* Convert the value if we have one */
if(value != NULL)
*jitter = strtod(value, &nptr);
/* If value is null or no conversion was performed */
if(value == NULL || value==nptr){
- if(verbose) printf("error: unable to read server jitter response.\n");
+ if(verbose) printf("error: unable to read server jitter/dispersion response.\n");
*jitter = -1;
} else {
if(verbose) printf("%g\n", *jitter);
@@ -391,6 +393,8 @@
printf("parsing stratum from peer %.2x: ", ntohs(peers[i].assoc));
}
value = extract_value(data, "stratum");
+ nptr=NULL;
+ /* Convert the value if we have one */
if(value != NULL)
*stratum = strtol(value, &nptr, 10);
if(value == NULL || value==nptr){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
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.