File openssh-7.2p2-no_fork-no_pid_file.patch of Package openssh.29886

From 9dae7bf64a9047080660858ef7918702f0f9a28e Mon Sep 17 00:00:00 2001
From: Old openssh patches <pcerny@suse.com>
Date: Wed, 26 Oct 2022 09:52:42 +0200
Subject: [PATCH] openssh-7.2p2-no_fork-no_pid_file

# HG changeset patch
# Parent  55d17a9afaed6317d873dab40e1506f51457de7c
Do not write a PID file when not daemonizing (e.g. when running from systemd)
---
 sshd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sshd.c b/sshd.c
index 470bf44f..5ac161f2 100644
--- a/sshd.c
+++ b/sshd.c
@@ -2116,7 +2116,7 @@ main(int ac, char **av)
 		 * Write out the pid file after the sigterm handler
 		 * is setup and the listen sockets are bound
 		 */
-		if (options.pid_file != NULL && !debug_flag) {
+		if (!no_daemon_flag && options.pid_file != NULL && !debug_flag) {
 			FILE *f = fopen(options.pid_file, "w");
 
 			if (f == NULL) {
-- 
2.38.0

openSUSE Build Service is sponsored by