Prune garbage from keyboard from before terminal started

This commit is contained in:
Kevin Lange 2015-07-12 19:23:59 +09:00
parent 06b57c14f8
commit 4cf6843441

View File

@ -619,6 +619,14 @@ void * handle_incoming(void * garbage) {
key_event_state_t kbd_state = {0}; key_event_state_t kbd_state = {0};
/* Prune any keyboard input we got before the terminal started. */
struct stat s;
fstat(kfd, &s);
for (int i = 0; i < s.st_size; i++) {
char tmp[1];
read(kfd, tmp, 1);
}
while (!exit_application) { while (!exit_application) {
int r = read(kfd, &c, 1); int r = read(kfd, &c, 1);
if (r > 0) { if (r > 0) {