summaryrefslogtreecommitdiff
path: root/net/nagios-base
diff options
context:
space:
mode:
authormanu <manu@pkgsrc.org>2017-08-20 06:59:16 +0000
committermanu <manu@pkgsrc.org>2017-08-20 06:59:16 +0000
commit7462398f5c99b5fea2aae512d625c0d1315408e6 (patch)
treef1b80902c6f7a6bd073269644bfb30947395f9a7 /net/nagios-base
parentd177446893e00537edb276b217caf32594f351c8 (diff)
downloadpkgsrc-7462398f5c99b5fea2aae512d625c0d1315408e6.tar.gz
Fix nagios unability to cleanup checkresults directory
From upstream https://github.com/NagiosEnterprises/nagioscore/pull/417 Once nagios is done with a file in the checkresults directory, it deletes it. This was done with a relative file path, causing failures if nagios working directory is not the checkresults directory. As a consequence, old result file remained intact, causing system slowdowns as the directory grew and nagios spent more and more time attempting to clean it up. The fix is just to use an absolute path, so that it works regardeless of current directory setting.
Diffstat (limited to 'net/nagios-base')
-rw-r--r--net/nagios-base/Makefile4
-rw-r--r--net/nagios-base/distinfo3
-rw-r--r--net/nagios-base/patches/patch-base_utils.c62
3 files changed, 66 insertions, 3 deletions
diff --git a/net/nagios-base/Makefile b/net/nagios-base/Makefile
index 2f6b88275ef..078348c7b12 100644
--- a/net/nagios-base/Makefile
+++ b/net/nagios-base/Makefile
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.72 2017/08/14 15:24:30 jlam Exp $
+# $NetBSD: Makefile,v 1.73 2017/08/20 06:59:16 manu Exp $
#
DISTNAME= nagios-4.3.2
PKGNAME= ${DISTNAME:S/-/-base-/}
-PKGREVISION= 2
+PKGREVISION= 3
CATEGORIES= net sysutils
DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=nagios/}
diff --git a/net/nagios-base/distinfo b/net/nagios-base/distinfo
index eb45d4e6236..ec7551cba5a 100644
--- a/net/nagios-base/distinfo
+++ b/net/nagios-base/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.31 2017/05/24 07:42:39 manu Exp $
+$NetBSD: distinfo,v 1.32 2017/08/20 06:59:16 manu Exp $
SHA1 (nagios-4.3.2.tar.gz) = 3a8a765583bd0588e77d87d32d7f2d618911c1f0
RMD160 (nagios-4.3.2.tar.gz) = f6e8f13b3c6caed38a8d83112b880ab2a2e1c6c9
@@ -14,6 +14,7 @@ SHA1 (patch-base_checks.c) = 9c5fb7a8f085eed2fb31ad623eeed22596c6c168
SHA1 (patch-base_events.c) = 6b659c6980c69ab1947d7a829c87482f53ed817e
SHA1 (patch-base_logging.c) = e0efd9dc51dd9f726ada11c6e7745e1cd9755bc9
SHA1 (patch-base_nerd.c) = 4105d3a56999077688e42c9c771e76461fe00785
+SHA1 (patch-base_utils.c) = aaf6396ec4f8454a3f4a8e92a4881c32ff331dc0
SHA1 (patch-cgi_Makefile.in) = 25c22914986c0b781f5dd665a7a53778e1031a63
SHA1 (patch-cgi_avail.c) = 44b4b0f9eaf43dd35ea6c048b6fc1dbb295c7aeb
SHA1 (patch-cgi_cmd.c) = edbf60422c4f36f045e97b27494bc7307c60143e
diff --git a/net/nagios-base/patches/patch-base_utils.c b/net/nagios-base/patches/patch-base_utils.c
new file mode 100644
index 00000000000..a2c8d036120
--- /dev/null
+++ b/net/nagios-base/patches/patch-base_utils.c
@@ -0,0 +1,62 @@
+$NetBSD: patch-base_utils.c,v 1.1 2017/08/20 06:59:16 manu Exp $
+
+From upstream https://github.com/NagiosEnterprises/nagioscore/pull/417
+
+Once nagios is done with a file in the checkresults directory,
+it deletes it. This was done with a relative file path, causing
+failures if nagios working directory is not the checkresults
+directory. As a consequence, old result file remained intact,
+causing system slowdowns as the directory grew and nagios spent
+more and more time attempting to clean it up.
+
+The fix is just to use an absolute path, so that it works
+regardeless of current directory setting.
+
+From 42f115ad87cf9113252f1d2ab88fc822ce052f56 Mon Sep 17 00:00:00 2001
+From: Bryan Heden <bheden@nagios.com>
+Date: Sat, 19 Aug 2017 12:02:34 -0500
+Subject: [PATCH] use absolute paths when deleting in checkresults directory.
+ github pull #417
+
+---
+ base/utils.c | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
+
+diff --git base/utils.c base/utils.c
+index f2286c73..8116ebf9 100644
+--- base/utils.c
++++ base/utils.c
+@@ -2133,7 +2133,11 @@ int process_check_result_queue(char *dirname) {
+
+ /* if the file is too old, we delete it */
+ if (stat_buf.st_mtime + max_check_result_file_age < time(NULL)) {
+- delete_check_result_file(dirfile->d_name);
++
++ if (delete_check_result_file(file) != OK
++ && delete_check_result_file(dirfile->d_name) != OK)
++ logit(NSLOG_RUNTIME_WARNING, TRUE, "Error: Unable to delete '%s' or '%s'!", file, dirfile->d_name);
++
+ continue;
+ }
+
+@@ -2363,16 +2367,17 @@ int process_check_result_file(char *fname) {
+ /* deletes as check result file, as well as its ok-to-go file */
+ int delete_check_result_file(char *fname) {
+ char *temp_buffer = NULL;
++ int result = OK;
+
+ /* delete the result file */
+- unlink(fname);
++ result = unlink(fname);
+
+ /* delete the ok-to-go file */
+ asprintf(&temp_buffer, "%s.ok", fname);
+- unlink(temp_buffer);
++ result |= unlink(temp_buffer);
+ my_free(temp_buffer);
+
+- return OK;
++ return result;
+ }
+
+