Skip to content

Commit

Permalink
Ensure that all input bytes are ready to be read
Browse files Browse the repository at this point in the history
  • Loading branch information
p-gen committed Oct 10, 2022
1 parent b332fef commit 002f453
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions smenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2427,9 +2427,9 @@ get_scancode(unsigned char * s, size_t max)
size_t i = 1;
struct termios original_ts, nowait_ts;

/* Flush non-transmitted, non-read input data. */
/* """"""""""""""""""""""""""""""""""""""""""" */
tcflush(0, TCIFLUSH);
/* Wait until all data has been transmitted to stdin. */
/* """""""""""""""""""""""""""""""""""""""""""""""""" */
tcdrain(0);

if ((c = my_fgetc(stdin)) == EOF)
return 0;
Expand Down

0 comments on commit 002f453

Please sign in to comment.