Blame openssh-7.4p1-daemon.patch
|
Jakub Jelen |
640dfa |
diff -up openssh-7.4p1/misc.c.daemon openssh-7.4p1/misc.c
|
|
Jakub Jelen |
640dfa |
--- openssh-7.4p1/misc.c.daemon 2017-02-03 13:08:14.751282516 +0100
|
|
Jakub Jelen |
640dfa |
+++ openssh-7.4p1/misc.c 2017-02-03 13:08:14.778282474 +0100
|
|
Jakub Jelen |
640dfa |
@@ -1273,6 +1273,9 @@ daemonized(void)
|
|
Jakub Jelen |
640dfa |
return 0; /* parent is not init */
|
|
Jakub Jelen |
640dfa |
if (getsid(0) != getpid())
|
|
Jakub Jelen |
640dfa |
return 0; /* not session leader */
|
|
Jakub Jelen |
640dfa |
+ if (getenv("_SSH_DAEMONIZED") == NULL)
|
|
Jakub Jelen |
640dfa |
+ return 0; /* already reexeced */
|
|
Jakub Jelen |
640dfa |
+
|
|
Jakub Jelen |
640dfa |
debug3("already daemonized");
|
|
Jakub Jelen |
640dfa |
return 1;
|
|
Jakub Jelen |
640dfa |
}
|
|
Jakub Jelen |
6cf9b8 |
diff -up openssh-7.4p1/sshd.c.daemon openssh-7.4p1/sshd.c
|
|
Jakub Jelen |
640dfa |
--- openssh-7.4p1/sshd.c.daemon 2017-02-03 13:08:14.755282510 +0100
|
|
Jakub Jelen |
640dfa |
+++ openssh-7.4p1/sshd.c 2017-02-03 13:09:29.765164356 +0100
|
|
Jakub Jelen |
640dfa |
@@ -1866,6 +1866,7 @@ main(int ac, char **av)
|
|
Jakub Jelen |
6cf9b8 |
if (daemon(0, 0) < 0)
|
|
Jakub Jelen |
6cf9b8 |
fatal("daemon() failed: %.200s", strerror(errno));
|
|
Jakub Jelen |
640dfa |
|
|
Jakub Jelen |
640dfa |
+ setenv("_SSH_DAEMONIZED", "1", 1);
|
|
Jakub Jelen |
640dfa |
disconnect_controlling_tty();
|
|
Jakub Jelen |
640dfa |
}
|
|
Jakub Jelen |
640dfa |
/* Reinitialize the log (because of the fork above). */
|