pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/net/nagios-base Fix nagios unability to cleanup checkr...
details: https://anonhg.NetBSD.org/pkgsrc/rev/fdedf20242f1
branches: trunk
changeset: 366951:fdedf20242f1
user: manu <manu%pkgsrc.org@localhost>
date: Sun Aug 20 06:59:16 2017 +0000
description:
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:
net/nagios-base/Makefile | 4 +-
net/nagios-base/distinfo | 3 +-
net/nagios-base/patches/patch-base_utils.c | 62 ++++++++++++++++++++++++++++++
3 files changed, 66 insertions(+), 3 deletions(-)
diffs (98 lines):
diff -r f9cc3413257e -r fdedf20242f1 net/nagios-base/Makefile
--- a/net/nagios-base/Makefile Sun Aug 20 03:30:33 2017 +0000
+++ b/net/nagios-base/Makefile Sun Aug 20 06:59:16 2017 +0000
@@ -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 -r f9cc3413257e -r fdedf20242f1 net/nagios-base/distinfo
--- a/net/nagios-base/distinfo Sun Aug 20 03:30:33 2017 +0000
+++ b/net/nagios-base/distinfo Sun Aug 20 06:59:16 2017 +0000
@@ -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_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 -r f9cc3413257e -r fdedf20242f1 net/nagios-base/patches/patch-base_utils.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/net/nagios-base/patches/patch-base_utils.c Sun Aug 20 06:59:16 2017 +0000
@@ -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@localhost>
+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;
+ }
+
+
Home |
Main Index |
Thread Index |
Old Index