File openssh-7.6p1-no_fork-no_pid_file.patch of Package openssh.21986
# HG changeset patch
# Parent 6a0455a6fd712e58791a6a3e04eec6a913b8e1ce
Do not write a PID file when not daemonizing (e.g. when running from systemd)
Index: openssh-7.6p1/sshd.c
===================================================================
--- openssh-7.6p1.orig/sshd.c 2019-03-12 14:38:33.272919131 +0100
+++ openssh-7.6p1/sshd.c 2019-03-12 14:38:35.060929187 +0100
@@ -1947,7 +1947,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) {