summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2008-09-26 18:17:04 +0000
committered <ed@FreeBSD.org>2008-09-26 18:17:04 +0000
commit2e07c6d9162dc6ee750caa091028120b60a94957 (patch)
tree72fa62fb1d10ba4d0567f7ee6535714630e0fd57
parentf2b740a1eaa294c4c5bac8a84fc6bf8d40d38a5d (diff)
downloadFreeBSD-src-2e07c6d9162dc6ee750caa091028120b60a94957.zip
FreeBSD-src-2e07c6d9162dc6ee750caa091028120b60a94957.tar.gz
Don't forget to initialize `int error' in ttydev_open().
I've had some reports in the past that opening an already opened TTY through, for example, /dev/tty can fail with random error codes. Looking at ttydev_open(), I can see there is a way `error' is returned without initialising it. Even though I haven't had any confirmation this fixes the bug, I'll fix it anyway. Reported by: Andrzej Tobola <ato iem pw edu pl>
-rw-r--r--sys/kern/tty.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 1a780ae..e31d070 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -204,7 +204,7 @@ static int
ttydev_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
{
struct tty *tp = dev->si_drv1;
- int error;
+ int error = 0;
/* Disallow access when the TTY belongs to a different prison. */
if (dev->si_cred != NULL &&
OpenPOWER on IntegriCloud