because it tries MTIOCTOP against stdin, the tty. It is very inconvenient
to use isatty to distinguish this difference in userland, so return ENOTTY
for tty devices.
ok natano
-/* $OpenBSD: kern_pledge.c,v 1.203 2017/04/13 04:06:46 guenther Exp $ */
+/* $OpenBSD: kern_pledge.c,v 1.204 2017/04/17 20:22:14 deraadt Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
case MTIOCTOP:
/* for pax(1) and such, checking tapes... */
if (fp->f_type == DTYPE_VNODE &&
- vp->v_type == VCHR &&
- (vp->v_flag & VISTTY) == 0)
- return (0);
+ vp->v_type == VCHR) {
+ if (vp->v_flag & VISTTY)
+ return (ENOTTY);
+ else
+ return (0);
+ }
break;
}
}