From: Alan Cox Date: Mon, 12 Jan 2015 11:13:19 +0000 (+0000) Subject: ioctl: tidy up a bit more X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=1c3d82b31a9b2a773600800192e84bc7ad678c4e;p=FUZIX.git ioctl: tidy up a bit more Unknown ioctls return ENOTTY not EINVAL (Unix history...) so we need to do the right thing. In addition we automatically set the errno so blkdev doesn't have to care about it --- diff --git a/Kernel/dev/blkdev.c b/Kernel/dev/blkdev.c index 99ae15b5..514bf644 100644 --- a/Kernel/dev/blkdev.c +++ b/Kernel/dev/blkdev.c @@ -125,10 +125,8 @@ int blkdev_ioctl(uint8_t minor, uint16_t request, char *data) blkdev_t *blk; data; /* unused */ - if (request != BLKFLSBUF) { - udata.u_error = ENXIO; + if (request != BLKFLSBUF) return -1; - } /* we trust that blkdev_open() has already verified that this minor number is valid */ blk = &blkdev_table[minor >> 4]; diff --git a/Kernel/devio.c b/Kernel/devio.c index 27e59960..f17285a0 100644 --- a/Kernel/devio.c +++ b/Kernel/devio.c @@ -277,7 +277,7 @@ int d_ioctl(uint16_t dev, uint16_t request, char *data) if ((*dev_tab[major(dev)].dev_ioctl) (minor(dev), request, data)) { if (!udata.u_error) // maybe the ioctl routine might set this? - udata.u_error = EINVAL; + udata.u_error = ENOTTY; return -1; }