shithub: mc

Download patch

ref: e0c639bd2eb7214fc1521c934b6033ee5b12b928
parent: f125cfb585a80fb1121da1f2b81cfbc319a1c1ac
author: Ori Bernstein <[email protected]>
date: Thu Dec 25 19:26:41 EST 2014

Fix bug in exit.

    We would infinitely loop if we weren't exiting with n >= 100

--- a/libstd/syswrap+plan9-x64.myr
+++ b/libstd/syswrap+plan9-x64.myr
@@ -98,12 +98,11 @@
 		i = 100
 		n = 0
 		while i > 0
-			if i > status
-				continue
+			if i <= status
+				idx = (status/i)
+				idx %= 10
+				buf[n++] = digitchars[idx]
 			;;
-			idx = (status/i)
-			idx %= 10
-			buf[n++] = digitchars[idx];
 			i /= 10
 		;;
 		sys.exits(buf[:n])