]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] Fix compat_ioctl
authorBen Collins <bcollins@debian.org>
Sun, 4 May 2003 04:03:34 +0000 (21:03 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sun, 4 May 2003 04:03:34 +0000 (21:03 -0700)
This fixes the compat_ioctl interface for the case where a NULL handler
is registered. This should produce a "compatible" as opposed to
"translated" interface for the specified ioctl. The patch was sent to
linux-kernel and no one complained (atleast with this second rev).

fs/compat.c

index 4a301f7dd9baad685ded7ac1c273978b3083cee7..1a834ba4d1a3968381cce2efc16f548880fec157 100644 (file)
@@ -300,7 +300,6 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, unsigned lon
 {
        struct file * filp;
        int error = -EBADF;
-       int (*handler)(unsigned int, unsigned int, unsigned long, struct file * filp);
        struct ioctl_trans *t;
 
        filp = fget(fd);
@@ -317,8 +316,10 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, unsigned lon
        while (t && t->cmd != cmd)
                t = (struct ioctl_trans *)t->next;
        if (t) {
-               handler = t->handler;
-               error = handler(fd, cmd, arg, filp);
+               if (t->handler)
+                       error = t->handler(fd, cmd, arg, filp);
+               else
+                       error = sys_ioctl(fd, cmd, arg);
        } else if (cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) {
                error = siocdevprivate_ioctl(fd, cmd, arg);
        } else {