Always assume that stdin is not a terminal when tcgetattr fails, instead of
printing an error message.
This commit is contained in:
parent
99e7138017
commit
0b9fe28288
14
main.c
14
main.c
|
|
@ -211,17 +211,8 @@ main(int argc, char **argv)
|
||||||
/* Save the original terminal settings. */
|
/* Save the original terminal settings. */
|
||||||
if (tcgetattr(0, &orig_term) < 0)
|
if (tcgetattr(0, &orig_term) < 0)
|
||||||
{
|
{
|
||||||
if (errno == ENOTTY)
|
memset(&orig_term, 0, sizeof(struct termios));
|
||||||
{
|
dont_have_tty = 1;
|
||||||
memset(&orig_term, 0, sizeof(struct termios));
|
|
||||||
dont_have_tty = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("%s: tcgetattr: %s\n", progname,
|
|
||||||
strerror(errno));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dont_have_tty && mode != 'n')
|
if (dont_have_tty && mode != 'n')
|
||||||
|
|
@ -230,6 +221,7 @@ main(int argc, char **argv)
|
||||||
progname);
|
progname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == 'a')
|
if (mode == 'a')
|
||||||
{
|
{
|
||||||
if (argc > 0)
|
if (argc > 0)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue