summaryrefslogtreecommitdiffstats
path: root/src/core/getkey.c
diff options
context:
space:
mode:
authorMichael Brown2011-03-07 18:40:12 +0100
committerMichael Brown2011-03-07 20:22:20 +0100
commit2969a8567ffd1e0fd1096199ec32b78beaf779fc (patch)
treea2aa94188d2208046d39c8e3a484ea41e6fdd89b /src/core/getkey.c
parent[bios] Recognise scancodes for F5-F12 inclusive (diff)
downloadipxe-2969a8567ffd1e0fd1096199ec32b78beaf779fc.tar.gz
ipxe-2969a8567ffd1e0fd1096199ec32b78beaf779fc.tar.xz
ipxe-2969a8567ffd1e0fd1096199ec32b78beaf779fc.zip
[console] Avoid timer wraparound problems in getchar_timeout()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/getkey.c')
-rw-r--r--src/core/getkey.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/getkey.c b/src/core/getkey.c
index d93ba1e6..5710f190 100644
--- a/src/core/getkey.c
+++ b/src/core/getkey.c
@@ -39,9 +39,9 @@ FILE_LICENCE ( GPL2_OR_LATER );
* @ret character Character read from console
*/
int getchar_timeout ( unsigned long timeout ) {
- unsigned long expiry = ( currticks() + timeout );
+ unsigned long start = currticks();
- while ( currticks() < expiry ) {
+ while ( ( currticks() - start ) < timeout ) {
step();
if ( iskey() )
return getchar();