It needs to check the file*, not the fd. --- 25-akpm/arch/x86_64/ia32/ia32_ioctl.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -puN arch/x86_64/ia32/ia32_ioctl.c~x86_64-tiocgdev-fix arch/x86_64/ia32/ia32_ioctl.c --- 25/arch/x86_64/ia32/ia32_ioctl.c~x86_64-tiocgdev-fix 2004-03-20 23:00:39.725903984 -0800 +++ 25-akpm/arch/x86_64/ia32/ia32_ioctl.c 2004-03-20 23:00:48.137625208 -0800 @@ -27,7 +27,7 @@ static int tiocgdev(unsigned fd, unsigne struct file *file = fget(fd); struct tty_struct *real_tty; - if (!fd) + if (!file) return -EBADF; if (file->f_op->ioctl != tty_ioctl) return -EINVAL; _