Skip to content

Commit 9aacd25

Browse files
committed
src/bin: minor, fix warning from Coverity Scan
Signed-off-by: Joachim Wiberg <[email protected]>
1 parent 867ea6e commit 9aacd25

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/bin/util.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
static char rawgetch(void)
1515
{
1616
struct termios saved, c;
17-
char key;
17+
int key;
1818

1919
if (tcgetattr(fileno(stdin), &saved) < 0)
2020
return -1;
@@ -33,7 +33,10 @@ static char rawgetch(void)
3333
key = getchar();
3434
tcsetattr(fileno(stdin), TCSANOW, &saved);
3535

36-
return key;
36+
if (key == EOF)
37+
return -1;
38+
39+
return (char)key;
3740
}
3841

3942
int yorn(const char *fmt, ...)

0 commit comments

Comments
 (0)