summaryrefslogtreecommitdiffstats
path: root/sys/dev/snp
diff options
context:
space:
mode:
authordd <dd@FreeBSD.org>2001-11-24 15:34:18 +0000
committerdd <dd@FreeBSD.org>2001-11-24 15:34:18 +0000
commitee8055d6038d7928288598a4238513bc459ed3bb (patch)
tree05ff777590ddcbdf66d3c8aef5ab21ad7418d46c /sys/dev/snp
parentc862b766f821c82c5ae19ba4e9dfe7bad08549b5 (diff)
downloadFreeBSD-src-ee8055d6038d7928288598a4238513bc459ed3bb.zip
FreeBSD-src-ee8055d6038d7928288598a4238513bc459ed3bb.tar.gz
Return EBUSY if we try to attach to a tty that is already being
snooped on. This causes all kinds of Bad Things(tm) to happen since closing one session will clobber state that's needed for the other one. This could theoretically be supported if the code was careful, but until somebody implements that, preventing this will stop people from unknowingly shooting themselves in the foot.
Diffstat (limited to 'sys/dev/snp')
-rw-r--r--sys/dev/snp/snp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c
index e6cf797..0b45047 100644
--- a/sys/dev/snp/snp.c
+++ b/sys/dev/snp/snp.c
@@ -508,6 +508,8 @@ snpioctl(dev, cmd, data, flags, td)
tp = snpdevtotty(tdev);
if (!tp)
return (EINVAL);
+ if (tp->t_state & TS_SNOOP)
+ return (EBUSY);
s = spltty();
OpenPOWER on IntegriCloud