I'm aware I'm kicking an old horse here, but...
On Thu, Mar 10, 2016 at 12:52:35PM +0100, Marc Espie wrote:
> @@ -106,5 +108,17 @@ opendev(const char *path, int oflags, in
> if (realpath)
> *realpath = namebuf;
If anything like this goes in (or did it already?) the *realpath
assignment should probably happen iff passing the new chunk.
/Alexander
>
> + if (fd != -1) {
> + if (fstat(fd, &st) == -1) {
> + close(fd);
> + return (-1);
> + }
> + if ((dflags & OPENDEV_BLCK) ? !S_ISBLK(st.st_mode) :
> + !S_ISCHR(st.st_mode)) {
> + close(fd);
> + errno = EFTYPE;
> + return (-1);
> + }
> + }
> return (fd);
> }
>