From 1c5eab6fe986d601d73b71c7d4f8dd3b51d93fd0 Mon Sep 17 00:00:00 2001 From: dtucker Date: Fri, 5 Nov 2004 09:09:09 +0000 Subject: [PATCH] - mickey@cvs.openbsd.org 2004/09/15 18:42:27 [sshd.c] use less doubles in daemons; markus@ ok --- ChangeLog | 3 +++ sshd.c | 9 ++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index ae5bfab5..47effe08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,9 @@ From Michael Knudsen, with wording changed slightly to match the PrintMotd description. ok djm + - mickey@cvs.openbsd.org 2004/09/15 18:42:27 + [sshd.c] + use less doubles in daemons; markus@ ok 20041102 - (dtucker) [configure.ac includes.h] Bug #947: Fix compile error on HP-UX diff --git a/sshd.c b/sshd.c index 4b2d10af..2afe316c 100644 --- a/sshd.c +++ b/sshd.c @@ -42,7 +42,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshd.c,v 1.302 2004/08/28 01:01:48 djm Exp $"); +RCSID("$OpenBSD: sshd.c,v 1.303 2004/09/15 18:42:27 mickey Exp $"); #include #include @@ -750,7 +750,7 @@ get_hostkey_index(Key *key) static int drop_connection(int startups) { - double p, r; + int p, r; if (startups < options.max_startups_begin) return 0; @@ -761,10 +761,9 @@ drop_connection(int startups) p = 100 - options.max_startups_rate; p *= startups - options.max_startups_begin; - p /= (double) (options.max_startups - options.max_startups_begin); + p /= options.max_startups - options.max_startups_begin; p += options.max_startups_rate; - p /= 100.0; - r = arc4random() / (double) UINT_MAX; + r = arc4random() % 100; debug("drop_connection: p %g, r %g", p, r); return (r < p) ? 1 : 0; -- 2.45.1