OSDN Git Service

Merge branch 'work.tty-ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[uclinux-h8/linux.git] / drivers / tty / tty_io.c
index cd8df45..da3c1c2 100644 (file)
@@ -1256,6 +1256,7 @@ static void tty_driver_remove_tty(struct tty_driver *driver, struct tty_struct *
 static int tty_reopen(struct tty_struct *tty)
 {
        struct tty_driver *driver = tty->driver;
+       int retval;
 
        if (driver->type == TTY_DRIVER_TYPE_PTY &&
            driver->subtype == PTY_TYPE_MASTER)
@@ -1269,10 +1270,14 @@ static int tty_reopen(struct tty_struct *tty)
 
        tty->count++;
 
-       if (!tty->ldisc)
-               return tty_ldisc_reinit(tty, tty->termios.c_line);
+       if (tty->ldisc)
+               return 0;
 
-       return 0;
+       retval = tty_ldisc_reinit(tty, tty->termios.c_line);
+       if (retval)
+               tty->count--;
+
+       return retval;
 }
 
 /**
@@ -2881,7 +2886,7 @@ void __do_SAK(struct tty_struct *tty)
        do_each_pid_task(session, PIDTYPE_SID, p) {
                tty_notice(tty, "SAK: killed process %d (%s): by session\n",
                           task_pid_nr(p), p->comm);
-               send_sig(SIGKILL, p, 1);
+               group_send_sig_info(SIGKILL, SEND_SIG_PRIV, p, PIDTYPE_SID);
        } while_each_pid_task(session, PIDTYPE_SID, p);
 
        /* Now kill any processes that happen to have the tty open */
@@ -2889,7 +2894,7 @@ void __do_SAK(struct tty_struct *tty)
                if (p->signal->tty == tty) {
                        tty_notice(tty, "SAK: killed process %d (%s): by controlling tty\n",
                                   task_pid_nr(p), p->comm);
-                       send_sig(SIGKILL, p, 1);
+                       group_send_sig_info(SIGKILL, SEND_SIG_PRIV, p, PIDTYPE_SID);
                        continue;
                }
                task_lock(p);
@@ -2897,7 +2902,7 @@ void __do_SAK(struct tty_struct *tty)
                if (i != 0) {
                        tty_notice(tty, "SAK: killed process %d (%s): by fd#%d\n",
                                   task_pid_nr(p), p->comm, i - 1);
-                       force_sig(SIGKILL, p);
+                       group_send_sig_info(SIGKILL, SEND_SIG_PRIV, p, PIDTYPE_SID);
                }
                task_unlock(p);
        } while_each_thread(g, p);