From: Joshua Klinesmith Date: Mon, 30 Mar 2026 19:52:39 +0000 (-0400) Subject: stunnel: create PID directory before alt_config_file return X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=9e3c6682114ffa93ed3db88d76ca9600c98b3d53;p=openwrt-packages.git stunnel: create PID directory before alt_config_file return When alt_config_file is set, global_defs() returns before creating the PID file directory. stunnel then fails to start because it cannot write its PID file to the nonexistent directory. Move the PID directory creation and ownership setup above the alt_config_file early return so it runs regardless of config mode. Fixes: openwrt/openwrt#28982 Signed-off-by: Joshua Klinesmith Co-Authored-By: Claude Opus 4.6 (1M context) --- diff --git a/net/stunnel/Makefile b/net/stunnel/Makefile index 2553625dc..9ce918871 100644 --- a/net/stunnel/Makefile +++ b/net/stunnel/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=stunnel PKG_VERSION:=5.75 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_LICENSE:=GPL-2.0-or-later PKG_MAINTAINER:=Florian Eckert diff --git a/net/stunnel/files/stunnel.init b/net/stunnel/files/stunnel.init index 6e364600d..875681d5c 100644 --- a/net/stunnel/files/stunnel.init +++ b/net/stunnel/files/stunnel.init @@ -338,6 +338,11 @@ global_defs() { # If the first globals section has alt_config_file, don't process any more globals [ -z "$HAVE_ALT_CONF_FILE" ] || return 0 + pid_dir="$(dirname "$PID_FILE")" + mkdir -p "$pid_dir" + [ -z "$setuid" ] || chown "$setuid" "$pid_dir" + [ -z "$setgid" ] || chown ":$setgid" "$pid_dir" + # If "alt_config_file" specified in the first globals section, use that instead [ -z "$alt_config_file" ] || [ -n "$CONF_FILE_CREATED" ] || { # Symlink "alt_config_file" since it's a bit easier and safer @@ -349,11 +354,6 @@ global_defs() { return 0 } - pid_dir="$(dirname "$PID_FILE")" - mkdir -p "$pid_dir" - [ -z "$setuid" ] || chown "$setuid" "$pid_dir" - [ -z "$setgid" ] || chown ":$setgid" "$pid_dir" - create_conf_file print_global_options validate_service_options globals "$1" print_service_options