|
@@ -1463,13 +1463,13 @@ static int tty_reopen(struct tty_struct *tty)
|
|
{
|
|
{
|
|
struct tty_driver *driver = tty->driver;
|
|
struct tty_driver *driver = tty->driver;
|
|
|
|
|
|
- if (!tty->count)
|
|
|
|
- return -EIO;
|
|
|
|
-
|
|
|
|
if (driver->type == TTY_DRIVER_TYPE_PTY &&
|
|
if (driver->type == TTY_DRIVER_TYPE_PTY &&
|
|
driver->subtype == PTY_TYPE_MASTER)
|
|
driver->subtype == PTY_TYPE_MASTER)
|
|
return -EIO;
|
|
return -EIO;
|
|
|
|
|
|
|
|
+ if (!tty->count)
|
|
|
|
+ return -EAGAIN;
|
|
|
|
+
|
|
if (test_bit(TTY_EXCLUSIVE, &tty->flags) && !capable(CAP_SYS_ADMIN))
|
|
if (test_bit(TTY_EXCLUSIVE, &tty->flags) && !capable(CAP_SYS_ADMIN))
|
|
return -EBUSY;
|
|
return -EBUSY;
|
|
|
|
|
|
@@ -2088,7 +2088,11 @@ retry_open:
|
|
|
|
|
|
if (IS_ERR(tty)) {
|
|
if (IS_ERR(tty)) {
|
|
retval = PTR_ERR(tty);
|
|
retval = PTR_ERR(tty);
|
|
- goto err_file;
|
|
|
|
|
|
+ if (retval != -EAGAIN || signal_pending(current))
|
|
|
|
+ goto err_file;
|
|
|
|
+ tty_free_file(filp);
|
|
|
|
+ schedule();
|
|
|
|
+ goto retry_open;
|
|
}
|
|
}
|
|
|
|
|
|
tty_add_file(tty, filp);
|
|
tty_add_file(tty, filp);
|