- if (GET_TTY(STDERR_FILENO, &mode) < 0)
- failed("standard error");
+ /*
+ * stderr is less likely to be redirected than stdout; try that first.
+ */
+ if (GET_TTY(STDERR_FILENO, &mode) < 0 &&
+ GET_TTY(STDOUT_FILENO, &mode) < 0) {
+ failed("terminal attributes");
+ }