Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1411dc4a authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman
Browse files

TTY: move pgrp killing



Move it to the only branch where tty_pgrp may be set. This is only a
cleanup which allows having tty_pgrp defined at that place.

Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent e30f867d
Loading
Loading
Loading
Loading
+7 −8
Original line number Original line Diff line number Diff line
@@ -790,19 +790,24 @@ static void session_clear_tty(struct pid *session)
void disassociate_ctty(int on_exit)
void disassociate_ctty(int on_exit)
{
{
	struct tty_struct *tty;
	struct tty_struct *tty;
	struct pid *tty_pgrp = NULL;


	if (!current->signal->leader)
	if (!current->signal->leader)
		return;
		return;


	tty = get_current_tty();
	tty = get_current_tty();
	if (tty) {
	if (tty) {
		tty_pgrp = get_pid(tty->pgrp);
		struct pid *tty_pgrp = get_pid(tty->pgrp);
		if (on_exit) {
		if (on_exit) {
			if (tty->driver->type != TTY_DRIVER_TYPE_PTY)
			if (tty->driver->type != TTY_DRIVER_TYPE_PTY)
				tty_vhangup(tty);
				tty_vhangup(tty);
		}
		}
		tty_kref_put(tty);
		tty_kref_put(tty);
		if (tty_pgrp) {
			kill_pgrp(tty_pgrp, SIGHUP, on_exit);
			if (!on_exit)
				kill_pgrp(tty_pgrp, SIGCONT, on_exit);
			put_pid(tty_pgrp);
		}
	} else if (on_exit) {
	} else if (on_exit) {
		struct pid *old_pgrp;
		struct pid *old_pgrp;
		spin_lock_irq(&current->sighand->siglock);
		spin_lock_irq(&current->sighand->siglock);
@@ -816,12 +821,6 @@ void disassociate_ctty(int on_exit)
		}
		}
		return;
		return;
	}
	}
	if (tty_pgrp) {
		kill_pgrp(tty_pgrp, SIGHUP, on_exit);
		if (!on_exit)
			kill_pgrp(tty_pgrp, SIGCONT, on_exit);
		put_pid(tty_pgrp);
	}


	spin_lock_irq(&current->sighand->siglock);
	spin_lock_irq(&current->sighand->siglock);
	put_pid(current->signal->tty_old_pgrp);
	put_pid(current->signal->tty_old_pgrp);