git: e39e03c9e703 - main - mail/dovecot: remove extra call to doveconf in rc.d script

From: Larry Rosenman <ler_at_FreeBSD.org>
Date: Mon, 24 Jun 2024 17:07:20 UTC
The branch main has been updated by ler:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e39e03c9e703c8f613d87bafd0a0f182ba3ed4e9

commit e39e03c9e703c8f613d87bafd0a0f182ba3ed4e9
Author:     Larry Rosenman <ler@FreeBSD.org>
AuthorDate: 2024-06-24 17:05:31 +0000
Commit:     Larry Rosenman <ler@FreeBSD.org>
CommitDate: 2024-06-24 17:05:31 +0000

    mail/dovecot: remove extra call to doveconf in rc.d script
    
    PR:     279867
    Reported by: Siva Mahadevan <me@svmhdvn.name>
---
 mail/dovecot/Makefile         |  2 +-
 mail/dovecot/files/dovecot.in | 18 +++++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/mail/dovecot/Makefile b/mail/dovecot/Makefile
index fd6c823fef69..c789da0a2294 100644
--- a/mail/dovecot/Makefile
+++ b/mail/dovecot/Makefile
@@ -10,7 +10,7 @@
 
 PORTNAME=	dovecot
 PORTVERSION=	2.3.21
-PORTREVISION=	5
+PORTREVISION=	6
 CATEGORIES=	mail
 MASTER_SITES=	https://dovecot.org/releases/2.3/
 
diff --git a/mail/dovecot/files/dovecot.in b/mail/dovecot/files/dovecot.in
index 8c717b0610c8..625ce85adcc5 100644
--- a/mail/dovecot/files/dovecot.in
+++ b/mail/dovecot/files/dovecot.in
@@ -58,15 +58,15 @@ for config in ${dovecot_config}; do
 	required_files="${config}"
 	command_args="-c ${config}"
 	if [ -s ${config} ]; then
-               ${command} ${command_args} -a 2>&1 >/dev/null
-                if [ $? -ne 0 ]; then
-                       echo "==Error=="
-                       echo "Configuration file check failed."
-                       # Use dovecot to print the config error.
-                       ${command} ${command_args} -a
-                       exit $?
-                fi
-		base_dir=$(${command} ${command_args} -a 2>/dev/null | /usr/bin/awk -F '= ' '/^base_dir =/ { print $2 }')
+		doveconf_settings="$(${command} ${command_args} -a 2>/dev/null)"
+		if [ $? -ne 0 ]; then
+			echo "==Error=="
+			echo "Configuration file check failed."
+			# Use dovecot to print the config error.
+			${command} ${command_args} -a
+			exit $?
+		fi
+		base_dir="$(echo "$doveconf_settings" | /usr/bin/awk -F '= ' '/^base_dir =/ { print $2 }')"
 		pidfile="${base_dir}/master.pid"
 	else
 		echo "==Error=="