From 9e3c6682114ffa93ed3db88d76ca9600c98b3d53 Mon Sep 17 00:00:00 2001 From: Joshua Klinesmith Date: Mon, 30 Mar 2026 15:52:39 -0400 Subject: [PATCH] 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) --- net/stunnel/Makefile | 2 +- net/stunnel/files/stunnel.init | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/net/stunnel/Makefile b/net/stunnel/Makefile index 2553625dcd..9ce9188712 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 6e364600d1..875681d5c9 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