git: e0c54af8111e - main - mail/opendkim: Properly create pidfile dir

From: Bryan Drewery <bdrewery_at_FreeBSD.org>
Date: Tue, 10 May 2022 20:17:26 UTC
The branch main has been updated by bdrewery:

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

commit e0c54af8111e5e82e461dc2a15df341a6970801e
Author:     Evilham <contact@evilham.com>
AuthorDate: 2022-03-10 18:41:48 +0000
Commit:     Bryan Drewery <bdrewery@FreeBSD.org>
CommitDate: 2022-05-10 20:17:23 +0000

    mail/opendkim: Properly create pidfile dir
    
    Submitted by:   Evilham
    Approved by:    maintainer timeout
    PR:             262473
---
 mail/opendkim/Makefile                 | 2 +-
 mail/opendkim/files/milter-opendkim.in | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/mail/opendkim/Makefile b/mail/opendkim/Makefile
index 7e8e2f02bda1..b47fd551da7a 100644
--- a/mail/opendkim/Makefile
+++ b/mail/opendkim/Makefile
@@ -2,7 +2,7 @@
 
 PORTNAME=	opendkim
 PORTVERSION=	2.10.3
-PORTREVISION=	15
+PORTREVISION=	16
 CATEGORIES=	mail security
 MASTER_SITES=	SF/${PORTNAME} \
 		SF/${PORTNAME}/Previous%20Releases \
diff --git a/mail/opendkim/files/milter-opendkim.in b/mail/opendkim/files/milter-opendkim.in
index 7672c9352e68..2ce969582af0 100644
--- a/mail/opendkim/files/milter-opendkim.in
+++ b/mail/opendkim/files/milter-opendkim.in
@@ -89,6 +89,9 @@ dkim_prepcmd()
 {
     dkim_cleansockets
     dkim_get_pidfile
+    if [ ! -d "$(dirname "$pidfile")" ]; then
+        mkdir "$(dirname "$pidfile")"
+    fi
     case ${milteropendkim_socket%:*} in
     local|unix)
 	socketfile=${milteropendkim_socket#*:}
@@ -202,6 +205,7 @@ else
 	if [ -n "${milteropendkim_alg}" ];then
 	    milteropendkim_alg="-S ${milteropendkim_alg}"
 	fi
+	dkim_get_pidfile
 	command_args="-l ${_socket_prefix} ${milteropendkim_socket} ${_uid_prefix} ${milteropendkim_uid} -P ${pidfile} ${milteropendkim_cfgfile} ${milteropendkim_domain} ${milteropendkim_key} ${milteropendkim_selector} ${milteropendkim_alg}"
     fi
 fi