summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2010-04-08 12:07:40 +0000
committerkib <kib@FreeBSD.org>2010-04-08 12:07:40 +0000
commit961511b4336c56732433f4fd9c21bbae470bb7f3 (patch)
tree78a769e4819d4b6d38dccb985b5ebacaba15a2ee /crypto
parent1e695d6c12ef2133b7015f9231ced3762c5b2e4a (diff)
downloadFreeBSD-src-961511b4336c56732433f4fd9c21bbae470bb7f3.zip
FreeBSD-src-961511b4336c56732433f4fd9c21bbae470bb7f3.tar.gz
Enhance r199804 by marking the daemonised child as immune to OOM instead
of short-living parent. Only mark the master process that accepts connections, do not protect connection handlers spawned from inetd. Submitted by: Mykola Dzham <i levsha me> Reviewed by: attilio MFC after: 1 week
Diffstat (limited to 'crypto')
-rw-r--r--crypto/openssh/sshd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/openssh/sshd.c b/crypto/openssh/sshd.c
index 0eccca0..5bd7cd4 100644
--- a/crypto/openssh/sshd.c
+++ b/crypto/openssh/sshd.c
@@ -1330,10 +1330,6 @@ main(int ac, char **av)
/* Initialize configuration options to their default values. */
initialize_server_options(&options);
- /* Avoid killing the process in high-pressure swapping environments. */
- if (madvise(NULL, 0, MADV_PROTECT) != 0)
- debug("madvise(): %.200s", strerror(errno));
-
/* Parse command-line arguments. */
while ((opt = getopt(ac, av, "f:p:b:k:h:g:u:o:C:dDeiqrtQRT46")) != -1) {
switch (opt) {
@@ -1749,6 +1745,10 @@ main(int ac, char **av)
/* Reinitialize the log (because of the fork above). */
log_init(__progname, options.log_level, options.log_facility, log_stderr);
+ /* Avoid killing the process in high-pressure swapping environments. */
+ if (!inetd_flag && madvise(NULL, 0, MADV_PROTECT) != 0)
+ debug("madvise(): %.200s", strerror(errno));
+
/* Initialize the random number generator. */
arc4random_stir();
OpenPOWER on IntegriCloud