Index: esh-sys-utils.c =================================================================== RCS file: /home/courses/cs3214/admin/cvs/psh/src-solution/esh-sys-utils.c,v retrieving revision 1.4 diff -u -r1.4 esh-sys-utils.c --- esh-sys-utils.c 21 Jan 2011 20:13:06 -0000 1.4 +++ esh-sys-utils.c 14 Oct 2011 16:01:43 -0000 @@ -88,9 +88,18 @@ void esh_sys_tty_restore(struct termios *saved_tty_state) { - int rc = tcsetattr(terminal_fd, TCSADRAIN, saved_tty_state); - if (rc == -1) + int rc; + +retry: + rc = tcsetattr(terminal_fd, TCSADRAIN, saved_tty_state); + if (rc == -1) { + /* tcsetattr, apparently, does not restart even with SA_RESTART, + * so repeat call on EINTR. */ + if (errno == EINTR) + goto retry; + esh_sys_fatal_error("could not restore tty attributes tcsetattr: "); + } } /* Get a file descriptor that refers to controlling terminal */