]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
Bash-4.2 patch 15
authorChet Ramey <chet.ramey@case.edu>
Wed, 23 Nov 2011 01:02:56 +0000 (20:02 -0500)
committerChet Ramey <chet.ramey@case.edu>
Wed, 23 Nov 2011 01:02:56 +0000 (20:02 -0500)
expr.c
patchlevel.h

diff --git a/expr.c b/expr.c
index 2177cfad1fd12a6fad54c6d6dcf234da11ede12b..14cdca228a42467c7b5a8ff23aacad828efc9e0d 100644 (file)
--- a/expr.c
+++ b/expr.c
@@ -476,19 +476,23 @@ expassign ()
 
       if (special)
        {
+         if ((op == DIV || op == MOD) && value == 0)
+           {
+             if (noeval == 0)
+               evalerror (_("division by 0"));
+             else
+               value = 1;
+           }
+
          switch (op)
            {
            case MUL:
              lvalue *= value;
              break;
            case DIV:
-             if (value == 0)
-               evalerror (_("division by 0"));
              lvalue /= value;
              break;
            case MOD:
-             if (value == 0)
-               evalerror (_("division by 0"));
              lvalue %= value;
              break;
            case PLUS:
@@ -804,7 +808,12 @@ exp2 ()
       val2 = exppower ();
 
       if (((op == DIV) || (op == MOD)) && (val2 == 0))
-       evalerror (_("division by 0"));
+       {
+         if (noeval == 0)
+           evalerror (_("division by 0"));
+         else
+           val2 = 1;
+       }
 
       if (op == MUL)
        val1 *= val2;
index 04b423b56701a39e659a27edcff733b59f04a795..05c9cc3ab1c4482dfbfc3d7b27fa7f44bb7bc751 100644 (file)
@@ -25,6 +25,6 @@
    regexp `^#define[   ]*PATCHLEVEL', since that's what support/mkversion.sh
    looks for to find the patch level (for the sccs version string). */
 
-#define PATCHLEVEL 14
+#define PATCHLEVEL 15
 
 #endif /* _PATCHLEVEL_H_ */