2013-09-19 06:09:33 +02:00
|
|
|
# Do not write a PID file when not daemonizing (e.g. when running from systemd)
|
|
|
|
|
2014-01-31 13:18:41 +01:00
|
|
|
diff --git a/openssh-6.4p1/sshd.c b/openssh-6.4p1/sshd.c
|
|
|
|
--- a/openssh-6.4p1/sshd.c
|
|
|
|
+++ b/openssh-6.4p1/sshd.c
|
|
|
|
@@ -1959,17 +1959,17 @@ main(int ac, char **av)
|
2013-09-19 06:09:33 +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 (!debug_flag) {
|
|
|
|
+ if (!(debug_flag || no_daemon_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);
|