소스 검색

[console] Avoid timer wraparound problems in getchar_timeout()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 년 전
부모
커밋
2969a8567f
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2
    2
      src/core/getkey.c

+ 2
- 2
src/core/getkey.c 파일 보기

@@ -39,9 +39,9 @@ FILE_LICENCE ( GPL2_OR_LATER );
39 39
  * @ret character	Character read from console
40 40
  */
41 41
 int getchar_timeout ( unsigned long timeout ) {
42
-	unsigned long expiry = ( currticks() + timeout );
42
+	unsigned long start = currticks();
43 43
 
44
-	while ( currticks() < expiry ) {
44
+	while ( ( currticks() - start ) < timeout ) {
45 45
 		step();
46 46
 		if ( iskey() )
47 47
 			return getchar();

Loading…
취소
저장