+ VOP_LOCK(ttyvp);
+#ifdef PARANOID
+ /*
+ * Since group is tty and mode is 620 on most terminal lines
+ * and since sessions protect terminals from processes outside
+ * your session, this check is probably no longer necessary.
+ * Since it inhibits setuid root programs that later switch
+ * to another user from accessing /dev/tty, we have decided
+ * to delete this test. (mckusick 5/93)
+ */
+ error = VOP_ACCESS(ttyvp,
+ (flag&FREAD ? VREAD : 0) | (flag&FWRITE ? VWRITE : 0), p->p_ucred, p);
+ if (!error)
+#endif /* PARANOID */
+ error = VOP_OPEN(ttyvp, flag, NOCRED, p);
+ VOP_UNLOCK(ttyvp);
+ return (error);