Change the errno to ENOTTY when encountering an unknown ioctl command as
authoranton <anton@openbsd.org>
Wed, 15 Sep 2021 04:57:47 +0000 (04:57 +0000)
committeranton <anton@openbsd.org>
Wed, 15 Sep 2021 04:57:47 +0000 (04:57 +0000)
opposed of using EINVAL which is ambiguous in this context.

ok deraadt@

sys/dev/usb/uhid.c

index 883a65c..90a75d8 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uhid.c,v 1.86 2021/09/12 06:58:08 anton Exp $ */
+/*     $OpenBSD: uhid.c,v 1.87 2021/09/15 04:57:47 anton Exp $ */
 /*     $NetBSD: uhid.c,v 1.57 2003/03/11 16:44:00 augustss Exp $       */
 
 /*
@@ -392,7 +392,7 @@ uhid_do_ioctl(struct uhid_softc *sc, u_long cmd, caddr_t addr,
        default:
                rc = uhidev_ioctl(&sc->sc_hdev, cmd, addr, flag, p);
                if (rc == -1)
-                       rc = EINVAL;
+                       rc = ENOTTY;
                return rc;
        }
        return (0);