--- um.orig/arch/um/drivers/chan_kern.c 2004-07-26 11:43:52.000000000 -0700 +++ um/arch/um/drivers/chan_kern.c 2004-07-31 19:38:51.000000000 -0700 @@ -117,15 +117,15 @@ { struct termios save, new; int err; + int changed = 0; - if(isatty(fd)){ - tcgetattr(fd, &save); + if(isatty(fd) && tcgetattr(fd, &save) == 0) { new = save; new.c_oflag |= OPOST; - tcsetattr(fd, TCSAFLUSH, &new); + if(tcsetattr(fd, TCSAFLUSH, &new) == 0) changed = 1; } err = generic_write(fd, buf, n, NULL); - if(isatty(fd)) tcsetattr(fd, TCSAFLUSH, &save); + if(changed) tcsetattr(fd, TCSAFLUSH, &save); return(err); }