2016-09-30 22:34:19 +02:00
|
|
|
# HG changeset patch
|
2016-10-07 17:57:29 +02:00
|
|
|
# Parent 7ce81a30bb196401c63782b646d8a6d511ddec4b
|
2016-09-30 22:34:19 +02:00
|
|
|
Do not write a PID file when not daemonizing (e.g. when running from systemd)
|
|
|
|
|
|
|
|
diff --git a/openssh-7.2p2/sshd.c b/openssh-7.2p2/sshd.c
|
|
|
|
--- a/openssh-7.2p2/sshd.c
|
|
|
|
+++ b/openssh-7.2p2/sshd.c
|
2016-10-07 17:57:29 +02:00
|
|
|
@@ -2107,17 +2107,17 @@ main(int ac, char **av)
|
2016-09-30 22:34:19 +02:00
|
|
|
signal(SIGCHLD, main_sigchld_handler);
|
|
|
|
signal(SIGTERM, sigterm_handler);
|
|
|
|
signal(SIGQUIT, sigterm_handler);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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) {
|
|
|
|
error("Couldn't create pid file \"%s\": %s",
|
|
|
|
options.pid_file, strerror(errno));
|
|
|
|
} else {
|
|
|
|
fprintf(f, "%ld\n", (long) getpid());
|
|
|
|
fclose(f);
|