From: Keir Fraser Date: Thu, 12 Mar 2009 10:58:21 +0000 (+0000) Subject: pygrub: Workaround for Solaris CR 1143256. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~13992^2~104 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=dc350ed2b518858eb5bc74adf17c1d1a8061c39c;p=xen.git pygrub: Workaround for Solaris CR 1143256. The Solaris curses library has a broken timeout() function: after a first timeout() call with a positive value for an argument, subsequent calls will fail to reset it. So, getch() always times out, confusing the pygrub timer in the main loop. Add an extra check to avoid exiting prematurely. Signed-off-by: Frank van der Linden --- diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub index 0bd4578b9e..98b4352b85 100644 --- a/tools/pygrub/src/pygrub +++ b/tools/pygrub/src/pygrub @@ -441,7 +441,11 @@ class Grub: # Timed out waiting for a keypress if mytime != -1: mytime += 1 - if mytime >= int(timeout): + # curses.timeout() does not work properly on Solaris + # So we may come here even after a key has been pressed. + # Check both timeout and mytime to avoid exiting + # when we shouldn't. + if timeout != -1 and mytime >= int(timeout): self.isdone = True break else: