--- rxvt-unicode/src/ptytty.C 2006/01/03 16:32:33 1.27 +++ rxvt-unicode/src/ptytty.C 2006/01/06 05:37:59 1.30 @@ -4,7 +4,7 @@ * * All portions of code are copyright by their respective author/s. * Copyright (c) 1999-2001 Geoff Wing - * Copyright (c) 2004 Marc Lehmann + * Copyright (c) 2004-2006 Marc Lehmann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -398,7 +398,10 @@ rxvt_ptytty::close_tty () { - if (tty >= 0) close (tty); + if (tty < 0) + return; + + close (tty); tty = -1; } @@ -406,8 +409,7 @@ rxvt_ptytty::put () { #ifndef NO_SETOWNER_TTYDEV - if (tty >= 0) - privileges (RESTORE); + privileges (RESTORE); #endif if (pty >= 0) close (pty); @@ -454,24 +456,24 @@ rxvt_ptytty::set_utf8_mode (bool on) { #ifdef IUTF8 - if (pty != -1) + if (pty < 0) + return; + + struct termios tio; + + if (tcgetattr (pty, &tio) != -1) { - struct termios tio; + tcflag_t new_cflag = tio.c_iflag; - if (tcgetattr (pty, &tio) != -1) - { - tcflag_t new_cflag = tio.c_iflag; + if (on) + new_cflag |= IUTF8; + else + new_cflag &= ~IUTF8; - if (on) - new_cflag |= IUTF8; - else - new_cflag &= ~IUTF8; - - if (new_cflag != tio.c_iflag) - { - tio.c_iflag = new_cflag; - tcsetattr (pty, TCSANOW, &tio); - } + if (new_cflag != tio.c_iflag) + { + tio.c_iflag = new_cflag; + tcsetattr (pty, TCSANOW, &tio); } } #endif