int err;
if(isatty(fd)){
- CATCH_EINTR(err = tcgetattr(fd, &save));
- if (err)
- goto error;
+ tcgetattr(fd, &save);
new = save;
- /* The terminal becomes a bit less raw, to handle \n also as
- * "Carriage Return", not only as "New Line". Otherwise, the new
- * line won't start at the first column.*/
new.c_oflag |= OPOST;
- CATCH_EINTR(err = tcsetattr(fd, TCSAFLUSH, &new));
- if (err)
- goto error;
+ tcsetattr(fd, TCSAFLUSH, &new);
}
err = generic_write(fd, buf, n, NULL);
- /* Restore raw mode, in any case; we *must* ignore any error apart
- * EINTR, except for debug.*/
- if(isatty(fd))
- CATCH_EINTR(tcsetattr(fd, TCSAFLUSH, &save));
+ if(isatty(fd)) tcsetattr(fd, TCSAFLUSH, &save);
return(err);
-error:
- return(-errno);
}
static void winch_handler(int sig)