summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/dev/snp/snp.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c
index 6103a5d..a414d7c 100644
--- a/sys/dev/snp/snp.c
+++ b/sys/dev/snp/snp.c
@@ -184,11 +184,17 @@ snpdevtotty(dev)
struct cdev *dev;
{
struct cdevsw *cdp;
+ struct tty *tp;
- cdp = devsw(dev);
- if (cdp == NULL || (cdp->d_flags & D_TTY) == 0)
+ cdp = dev_refthread(dev);
+ if (cdp == NULL)
return (NULL);
- return (dev->si_tty);
+ if (!(cdp->d_flags & D_TTY))
+ tp = NULL;
+ else
+ tp = dev->si_tty;
+ dev_relthread(dev);
+ return (tp);
}
#define SNP_INPUT_BUF 5 /* This is even too much, the maximal
OpenPOWER on IntegriCloud