[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#3985: Wrong parameter type in src/getfd.c



Package: kbd
Version: 0.91-3

I wondered why the 'loadkeys' program didn't work as expected on m68k,
and then I found a little bug in src/getfd.c: It determines the keyboard
type via an ioctl (KDGKBTYPE) which returns a char on the kernel side, but 
is put into a 'long' variable. This just happens to work on i386, but breaks 
on m68k due to the endianess. Below is a patch.

Frank

Debian-1.1, libc5.2.18, kernel 2.0.8.

PS: Checking for just one explicit keyboard type (KB_101) is not good
either, but that will be fixed later.

--- cut here ---
*** src/getfd.c.orig    Thu Aug  1 00:30:13 MET DST 1996
--- src/getfd.c Thu Aug  1 00:30:23 MET DST 1996
***************
*** 14,20 ****
  
  static int
  is_a_console(int fd) {
!     long arg;
  
      arg = 0;
      return (ioctl(fd, KDGKBTYPE, &arg) == 0 && arg == KB_101);
--- 14,20 ----
  
  static int
  is_a_console(int fd) {
!     unsigned char arg;
  
      arg = 0;
      return (ioctl(fd, KDGKBTYPE, &arg) == 0 && arg == KB_101);



Reply to: