From 2ab4d8fc278413b01ff9c4e4496f892398f80a4c Mon Sep 17 00:00:00 2001 From: Benoit Mortier Date: Sun, 5 Dec 2004 00:54:09 +0000 Subject: fix patch 998291 fix patch 1078934 expect check_ssh fix and check_nt perfdata should stay on one word like in nagios git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1004 f882894a-f735-0410-b71e-b25c423dba1c --- plugins/check_icmp.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'plugins/check_icmp.c') diff --git a/plugins/check_icmp.c b/plugins/check_icmp.c index 45bfcc5e..361e924e 100644 --- a/plugins/check_icmp.c +++ b/plugins/check_icmp.c @@ -1,6 +1,8 @@ /* - * check_icmp - A hack of fping2 to work with nagios. - * This way we don't have to use the output parser. + * $Id$ + * + * This is a hack of fping2 made to work with nagios. + * It's fast and removes the necessity of parsing another programs output. * * VIEWING NOTES: * This file was formatted with tab indents at a tab stop of 4. @@ -40,14 +42,8 @@ #include #include -/* Linux has bizarre ip.h and ip_icmp.h */ -/* Taken from the fping distro. Thank you. */ -#if defined( __linux__ ) -#include "linux.h" -#else #include #include -#endif /* defined(__linux__) */ #include #include @@ -70,9 +66,8 @@ extern char *optarg; extern int optind, opterr; /*** Constants ***/ -#define REV_DATE "2004-09-06" #define EMAIL "ae@op5.se" -#define VERSION "0.8" +#define VERSION "0.8.1" #ifndef INADDR_NONE # define INADDR_NONE 0xffffffU @@ -441,7 +436,7 @@ int main(int argc, char **argv) break; case 'v': - printf("%s: Version %s $Date$\n", prog, VERSION, REV_DATE); + printf("%s: Version %s $Date$\n", prog, VERSION); printf("%s: comments to %s\n", prog, EMAIL); exit(STATE_OK); @@ -1275,7 +1270,7 @@ void u_sleep(int u_sec) * crash on any other errrors ************************************************************/ /* TODO: add MSG_DONTWAIT to recvfrom flags (currently 0) */ -int recvfrom_wto(int sock, char *buf, int len, struct sockaddr *saddr, int timo) +int recvfrom_wto(int lsock, char *buf, int len, struct sockaddr *saddr, int timo) { int nfound = 0, slen, n; struct timeval to; @@ -1289,8 +1284,8 @@ int recvfrom_wto(int sock, char *buf, int len, struct sockaddr *saddr, int timo) FD_ZERO(&readset); FD_ZERO(&writeset); - FD_SET(sock, &readset); - nfound = select(sock + 1, &readset, &writeset, NULL, &to); + FD_SET(lsock, &readset); + nfound = select(lsock + 1, &readset, &writeset, NULL, &to); if(nfound < 0) crash("select() in recvfrom_wto"); if(nfound == 0) return -1; /* timeout */ -- cgit v1.2.3