[lkml]   [1999]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    SubjectPATCH: tioccons() br0ken in 2.2 and 2.3
    In 2.2.x and 2.3.x the tioccons() function in tty_io.c tests if you
    are using it on the real console, which means that the console redirection
    should be turned off.

    However it doesn't work since

    1. the test is wrong; the wrong tty->driver.type is tested, and
    tty->driver.subtype should be tested as well
    2. it won't work anyway as those fields don't come from the new /dev/console
    device but from the actual device behind it (/dev/tty1 or /dev/ttyS0)

    So a better way is to test inode->i_rdev to check for /dev/console,
    just like it's done in tty_write()

    Patch against 2.3.15 follows, also applies against 2.2.12 (should go
    into 2.2.13 as well I think)

    diff -ruN linux-2.3.15/drivers/char/tty_io.c
    --- linux-2.3.15/drivers/char/tty_io.c Tue Aug 31 16:04:40 1999
    +++ Tue Aug 31 17:46:13 1999
    @@ -1499,10 +1499,11 @@
    return 0;

    -static int tioccons(struct tty_struct *tty, struct tty_struct *real_tty)
    +static int tioccons(struct inode *inode,
    + struct tty_struct *tty, struct tty_struct *real_tty)
    - if (tty->driver.type == TTY_DRIVER_TYPE_CONSOLE ||
    - tty->driver.type == TTY_DRIVER_TYPE_SYSCONS) {
    + if (inode->i_rdev == SYSCONS_DEV ||
    + inode->i_rdev == CONSOLE_DEV) {
    if (!suser())
    return -EPERM;
    redirect = NULL;
    @@ -1712,7 +1713,7 @@
    case TIOCSWINSZ:
    return tiocswinsz(tty, real_tty, (struct winsize *) arg);
    case TIOCCONS:
    - return tioccons(tty, real_tty);
    + return tioccons(inode, tty, real_tty);
    case FIONBIO:
    return fionbio(file, (int *) arg);
    case TIOCEXCL:

    ... somehow I have a feeling the hurting hasn't even begun yet
    -- Bill, "The Terrible Thunderlizards"

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:53    [W:2.045 / U:0.236 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site