[monitoring-plugins] Fix timeout_interval declarations

Sven Nierlein git at monitoring-plugins.org
Tue Jan 7 10:30:12 CET 2020


    Module: monitoring-plugins
    Branch: master
    Commit: 9da7cd76813870632ff93659d176ead0848b8ee9
    Author: Christian Tacke <8560110+ChristianTacke at users.noreply.github.com>
 Committer: Sven Nierlein <sven at nierlein.org>
      Date: Wed Dec 25 21:41:17 2019 +0100
       URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=9da7cd7

Fix timeout_interval declarations

There are different declarations for timeout_interval:

lib/utils_base.c has the definition:
	unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT;
lib/utils_base.h has the appropiate declaration:
	extern unsigned int timeout_interval;

plugins/popen.h has an extra declaration:
	extern unsigned int timeout_interval;
This doesn't hurt, but it's a dupe. The one in utils_base.h
should be enough, so remove this one.

plugins/popen.c has a WRONG one:
	extern int timeout_interval;
Remove it!
Use #include "utils.h" to get the right one.
This makes the local defines for max/min unnecassary, so
remove them also.

---

 plugins/popen.c | 4 +---
 plugins/popen.h | 1 -
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/plugins/popen.c b/plugins/popen.c
index 557fb44..9eb49b6 100644
--- a/plugins/popen.c
+++ b/plugins/popen.c
@@ -39,9 +39,9 @@
 *****************************************************************************/
 
 #include "common.h"
+#include "utils.h"
 
 /* extern so plugin has pid to kill exec'd process on timeouts */
-extern int timeout_interval;
 extern pid_t *childpid;
 extern int *child_stderr_array;
 extern FILE *child_process;
@@ -76,8 +76,6 @@ RETSIGTYPE popen_timeout_alarm_handler (int);
 #define	SIG_ERR	((Sigfunc *)-1)
 #endif
 
-#define	min(a,b)	((a) < (b) ? (a) : (b))
-#define	max(a,b)	((a) > (b) ? (a) : (b))
 
 char *pname = NULL;							/* caller can set this from argv[0] */
 
diff --git a/plugins/popen.h b/plugins/popen.h
index fc7e78e..a5dd8fa 100644
--- a/plugins/popen.h
+++ b/plugins/popen.h
@@ -7,7 +7,6 @@ FILE *spopen (const char *);
 int spclose (FILE *);
 RETSIGTYPE popen_timeout_alarm_handler (int);
 
-extern unsigned int timeout_interval;
 pid_t *childpid=NULL;
 int *child_stderr_array=NULL;
 FILE *child_process=NULL;



More information about the Commits mailing list