]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Do not try to divide by zero.
authorPavel Machek <pavel@ucw.cz>
Fri, 2 Jun 2000 08:01:12 +0000 (08:01 +0000)
committerPavel Machek <pavel@ucw.cz>
Fri, 2 Jun 2000 08:01:12 +0000 (08:01 +0000)
filter/filter.c
filter/test.conf

index 232a2d2ce159f0ee5667a678f5e3a47e95e9a9ee..776ad55677dc3ea853cf138ab9ff8a7d2de2ae05 100644 (file)
@@ -283,7 +283,8 @@ interpret(struct f_inst *what)
     TWOARGS_C;
     switch (res.type = v1.type) {
     case T_VOID: runtime( "Can not operate with values of type void" );
-    case T_INT: res.val.i = v1.val.i / v2.val.i; break;
+    case T_INT: if (v2.val.i == 0) runtime( "Mother told me not to divide by 0" );
+               res.val.i = v1.val.i / v2.val.i; break;
     case T_IP: if (v2.type != T_INT)
                  runtime( "Operator / is <ip>/<int>" );
                break;
index c1d5977d3565482b4088d011b5364e68ea35c5c1..1b635cb7ca5262361d6113b150c5832548080c6b 100644 (file)
@@ -1,5 +1,6 @@
 /*
  *     This is an example configuration file.
+ *     FIXME: add all examples from docs here.
  */
 
 # Yet another comment