Don't fail when the line discipline ioctl fails (since it secondary
like the other tty ioctls that we only warn about). Do the main ioctl (tcgetattr) first, since that provides a better error message (ENOTTY instead of EINVAL).
This commit is contained in:
parent
1d6035aaec
commit
0282eceed1
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: stty.c,v 1.23 2013/09/12 19:47:23 christos Exp $ */
|
||||
/* $NetBSD: stty.c,v 1.24 2019/09/06 16:28:53 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1989, 1991, 1993, 1994
|
||||
|
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1991, 1993, 1994\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)stty.c 8.3 (Berkeley) 4/2/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: stty.c,v 1.23 2013/09/12 19:47:23 christos Exp $");
|
||||
__RCSID("$NetBSD: stty.c,v 1.24 2019/09/06 16:28:53 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -97,10 +97,10 @@ main(int argc, char *argv[])
|
|||
args: argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (ioctl(i.fd, TIOCGLINED, i.ldisc) < 0)
|
||||
err(1, "TIOCGLINED");
|
||||
if (tcgetattr(i.fd, &i.t) < 0)
|
||||
err(1, "tcgetattr");
|
||||
if (ioctl(i.fd, TIOCGLINED, i.ldisc) < 0)
|
||||
warn("TIOCGLINED");
|
||||
if (ioctl(i.fd, TIOCGWINSZ, &i.win) < 0)
|
||||
warn("TIOCGWINSZ");
|
||||
if (ioctl(i.fd, TIOCGQSIZE, &i.queue) < 0)
|
||||
|
|
Loading…
Reference in New Issue