Skip to content

Commit

Permalink
evdev: Fix 'Syscall param ioctl(TIOCLINUX) points to uninitialised byte'
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonSchaefer committed Jul 28, 2017
1 parent 77ca0f2 commit be005b7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/linux/SDL_evdev_kbd.c
Expand Up @@ -196,7 +196,8 @@ SDL_EVDEV_kbd_init(void)
{
SDL_EVDEV_keyboard_state *kbd;
int i;
char shift_state, flag_state;
char flag_state;
char shift_state[2] = {TIOCL_GETSHIFTSTATE, 0};

kbd = (SDL_EVDEV_keyboard_state *)SDL_calloc(1, sizeof(*kbd));
if (!kbd) {
Expand All @@ -208,9 +209,8 @@ SDL_EVDEV_kbd_init(void)
/* This might fail if we're not connected to a tty (e.g. on the Steam Link) */
kbd->console_fd = open("/dev/tty", O_RDONLY);

shift_state = TIOCL_GETSHIFTSTATE;
if (ioctl(kbd->console_fd, TIOCLINUX, &shift_state) == 0) {
kbd->shift_state = shift_state;
if (ioctl(kbd->console_fd, TIOCLINUX, shift_state) == 0) {
kbd->shift_state = *shift_state;
}

if (ioctl(kbd->console_fd, KDGKBLED, &flag_state) == 0) {
Expand Down

0 comments on commit be005b7

Please sign in to comment.