From 2750d3d22dc21afa8267086806a88790a3fab716 Mon Sep 17 00:00:00 2001 From: jacksonfoz Date: Fri, 6 Nov 2020 13:54:52 -0300 Subject: [PATCH] check_disk_space: handle relative log_directory path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the log_directory resolves to a relative path, e.g. "../pg_log", the check_disk_space fails with an error like: ERROR: Invalid result from command "/bin/df -kP "../pg_log" 2>&1": /bin/df: รข: No such file or directory This patch adds a verification to check if the logdir variable starts with a .[dot] --- check_postgres.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_postgres.pl b/check_postgres.pl index edb47e1..f386437 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -5223,7 +5223,7 @@ sub check_disk_space { ## Check log_directory: relative or absolute if (length $logdir) { - if ($logdir =~ /^\w/) { ## relative, check only if symlinked + if ($logdir =~ /^[\w\.]/) { ## relative, check only if symlinked $logdir = "$datadir/$logdir"; if (-l $logdir) { my $linkdir = readlink($logdir);