aboutsummaryrefslogtreecommitdiffstats
path: root/com32/elflink/ldlinux/get_key.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2012-04-17 11:25:53 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2012-04-17 11:25:53 -0700
commitd5e02fb16a11bfdbce1e90a39e6cb5f2ad925389 (patch)
tree8b5bd7a18b18a586c60893ee5bfd2db952c903e5 /com32/elflink/ldlinux/get_key.c
parent429a41b4d33e8c34638de56a4a23e67337f9f34a (diff)
downloadsyslinux-d5e02fb16a11bfdbce1e90a39e6cb5f2ad925389.tar.gz
syslinux-d5e02fb16a11bfdbce1e90a39e6cb5f2ad925389.tar.xz
syslinux-d5e02fb16a11bfdbce1e90a39e6cb5f2ad925389.zip
get_key: Valid key values are positive
Make sure we return positive values for valid keystrokes. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'com32/elflink/ldlinux/get_key.c')
-rw-r--r--com32/elflink/ldlinux/get_key.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/com32/elflink/ldlinux/get_key.c b/com32/elflink/ldlinux/get_key.c
index 5841d022..0be06b98 100644
--- a/com32/elflink/ldlinux/get_key.c
+++ b/com32/elflink/ldlinux/get_key.c
@@ -167,7 +167,7 @@ int get_key(FILE * f, clock_t timeout)
clock_t lateness = times(NULL) - start;
if (nc && lateness > 1 + KEY_TIMEOUT) {
if (nc == 1)
- return buffer[0]; /* timeout in sequence */
+ return (unsigned char)buffer[0]; /* timeout */
else if (timeout && lateness > timeout)
return KEY_NONE;
} else if (!nc && timeout && lateness > timeout)
@@ -194,5 +194,5 @@ int get_key(FILE * f, clock_t timeout)
/* We got an unrecognized sequence; return the first character */
/* We really should remember this and return subsequent characters later */
- return buffer[0];
+ return (unsigned char)buffer[0];
}