int tty_release(struct inode *inode, struct file *filp)
{
struct tty_struct *tty = file_tty(filp);
- struct tty_struct *o_tty;
- int pty_master, do_sleep, final;
+ struct tty_struct *o_tty = NULL;
+ int do_sleep, final;
int idx;
char buf[64];
__tty_fasync(-1, filp, 0);
idx = tty->index;
- pty_master = (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
- tty->driver->subtype == PTY_TYPE_MASTER);
- /* Review: parallel close */
- o_tty = tty->link;
+ if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
+ tty->driver->subtype == PTY_TYPE_MASTER)
+ o_tty = tty->link;
if (tty_release_checks(tty, idx)) {
tty_unlock(tty);
do_sleep++;
}
}
- if (pty_master && o_tty->count <= 1) {
+ if (o_tty && o_tty->count <= 1) {
if (waitqueue_active(&o_tty->read_wait)) {
wake_up_poll(&o_tty->read_wait, POLLIN);
do_sleep++;
schedule();
}
- if (pty_master) {
+ if (o_tty) {
if (--o_tty->count < 0) {
printk(KERN_WARNING "%s: bad pty slave count (%d) for %s\n",
__func__, o_tty->count, tty_name(o_tty, buf));
if (!tty->count) {
read_lock(&tasklist_lock);
session_clear_tty(tty->session);
- if (pty_master)
+ if (o_tty)
session_clear_tty(o_tty->session);
read_unlock(&tasklist_lock);
}
/* check whether both sides are closing ... */
- final = !tty->count && !(pty_master && o_tty->count);
+ final = !tty->count && !(o_tty && o_tty->count);
tty_unlock_pair(tty, o_tty);
/* At this point, the tty->count == 0 should ensure a dead tty