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>
This commit is contained in:
Ed Schouten 2008-09-26 18:17:04 +00:00
parent 3b30175391
commit dacf7de1a6

View File

@ -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 &&