Module Name: src Committed By: christos Date: Fri Sep 6 16:28:53 UTC 2019
Modified Files: src/bin/stty: stty.c Log Message: 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). To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/bin/stty/stty.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/bin/stty/stty.c diff -u src/bin/stty/stty.c:1.23 src/bin/stty/stty.c:1.24 --- src/bin/stty/stty.c:1.23 Thu Sep 12 15:47:23 2013 +++ src/bin/stty/stty.c Fri Sep 6 12:28:53 2019 @@ -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, 19 #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)