summaryrefslogtreecommitdiff
path: root/sshd.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-11-05 20:09:09 +1100
committerDarren Tucker <dtucker@zip.com.au>2004-11-05 20:09:09 +1100
commit178fa66a6451d890083d2441a2de207bdb74a348 (patch)
treee3b8f6eb00afab49734625145a471335d6987552 /sshd.c
parent7cc5c23817e35938a1004e6815936f8e7baa94a2 (diff)
downloadopenssh-git-178fa66a6451d890083d2441a2de207bdb74a348.tar.gz
- mickey@cvs.openbsd.org 2004/09/15 18:42:27
[sshd.c] use less doubles in daemons; markus@ ok
Diffstat (limited to 'sshd.c')
-rw-r--r--sshd.c9
1 files changed, 4 insertions, 5 deletions
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 <openssl/dh.h>
#include <openssl/bn.h>
@@ -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;