]> andersk Git - openssh.git/commitdiff
- mickey@cvs.openbsd.org 2004/09/15 18:42:27
authordtucker <dtucker>
Fri, 5 Nov 2004 09:09:09 +0000 (09:09 +0000)
committerdtucker <dtucker>
Fri, 5 Nov 2004 09:09:09 +0000 (09:09 +0000)
     [sshd.c]
     use less doubles in daemons; markus@ ok

ChangeLog
sshd.c

index ae5bfab5f1e4f3d7283996d19d7998c47b8e461c..47effe087976bdf1bf4545a84b4798e5960986e3 100644 (file)
--- 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 4b2d10af9e67e8784d34ad51689d839be647352c..2afe316cf4f7c9ebd76001184f24cc8ef7b6ba2b 100644 (file)
--- 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;
This page took 0.155613 seconds and 5 git commands to generate.