Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/stty Don't fail when the line discipline ioctl fails (si...



details:   https://anonhg.NetBSD.org/src/rev/e2f36a3207ea
branches:  trunk
changeset: 454137:e2f36a3207ea
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Sep 06 16:28:53 2019 +0000

description:
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).

diffstat:

 bin/stty/stty.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r 00ca3408f99e -r e2f36a3207ea bin/stty/stty.c
--- a/bin/stty/stty.c   Fri Sep 06 14:37:00 2019 +0000
+++ b/bin/stty/stty.c   Fri Sep 06 16:28:53 2019 +0000
@@ -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 @@
 #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 @@
 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)



Home | Main Index | Thread Index | Old Index