diff options
author | 2004-09-15 18:42:27 +0000 | |
---|---|---|
committer | 2004-09-15 18:42:27 +0000 | |
commit | 031fc0c248d7e880a8727219ad55b548efd80d3d (patch) | |
tree | 073f7259ba03ddcf0e51d424462e2465d3388b4b | |
parent | if (signalflag) { dowork(); signalflag = 0; } is a race. First clear flag, (diff) | |
download | wireguard-openbsd-031fc0c248d7e880a8727219ad55b548efd80d3d.tar.xz wireguard-openbsd-031fc0c248d7e880a8727219ad55b548efd80d3d.zip |
use less doubles in daemons; markus@ ok
-rw-r--r-- | usr.bin/ssh/sshd.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c index cb6622578bd..50d0de8198d 100644 --- a/usr.bin/ssh/sshd.c +++ b/usr.bin/ssh/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> @@ -740,7 +740,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; @@ -751,10 +751,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; |