* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
- if (cur_term == 0
- || GET_TTY(cur_term->Filedes, buf) != 0)
- return (ERR);
+ int result = OK;
+
+ if (cur_term == 0) {
+ result = ERR;
+ } else {
+ for (;;) {
+ if (GET_TTY(cur_term->Filedes, buf) != 0) {
+ if (errno == EINTR)
+ continue;
+ result = ERR;
+ }
+ break;
+ }
+ }
+
+ if (result == ERR)
+ memset(buf, 0, sizeof(*buf));
+
TR(TRACE_BITS, ("_nc_get_tty_mode(%d): %s",
cur_term->Filedes, _nc_trace_ttymode(buf)));
TR(TRACE_BITS, ("_nc_get_tty_mode(%d): %s",
cur_term->Filedes, _nc_trace_ttymode(buf)));
TR(TRACE_BITS, ("_nc_set_tty_mode(%d): %s",
cur_term->Filedes, _nc_trace_ttymode(buf)));
TR(TRACE_BITS, ("_nc_set_tty_mode(%d): %s",
cur_term->Filedes, _nc_trace_ttymode(buf)));