37 lines
1.1 KiB
Text
37 lines
1.1 KiB
Text
$NetBSD: patch-ad,v 1.1 2008/03/03 11:45:17 sketch Exp $
|
|
|
|
--- throttle.c.orig 2008-03-03 11:09:11.691752000 +0000
|
|
+++ throttle.c 2008-03-03 11:26:23.792297000 +0000
|
|
@@ -155,19 +155,21 @@
|
|
logmessage("DEBUG: fd: %d: tresult: %d\n", fd, tresult);
|
|
|
|
/* percentage won, set attribute accordingly */
|
|
- switch (tresult)
|
|
- {
|
|
-
|
|
- case 0 ... 49: tattrib_array[fd][0] = 'a'; break;
|
|
- case 50 ... 89: tattrib_array[fd][0] = 'w'; break;
|
|
- case 90 ... 900000: tattrib_array[fd][0] = 'p'; break;
|
|
- /* allow for big percentage overshoot */
|
|
+ if (tresult >= 0 && tresult <= 49)
|
|
+ tattrib_array[fd][0] = 'a';
|
|
|
|
- default:
|
|
- logmessage("fatal: throttle_check(): invalid tresult: %d\n", tresult);
|
|
- return (-1);
|
|
- }
|
|
+ else if (tresult >= 50 && tresult <= 89)
|
|
+ tattrib_array[fd][0] = 'w';
|
|
|
|
+ /* allow for big percentage overshoot */
|
|
+ else if (tresult >= 90 && tresult <= 900000)
|
|
+ tattrib_array[fd][0] = 'p';
|
|
+
|
|
+ else {
|
|
+ logmessage("fatal: throttle_check(): invalid tresult: %d\n", tresult);
|
|
+ return (-1);
|
|
+ }
|
|
+
|
|
/* we selectively choose which throttle module we want */
|
|
switch(tnum)
|
|
{
|