aboutsummaryrefslogtreecommitdiff
path: root/bin/stty
diff options
context:
space:
mode:
authorJoerg Wunsch <joerg@FreeBSD.org>1995-07-02 08:54:27 +0000
committerJoerg Wunsch <joerg@FreeBSD.org>1995-07-02 08:54:27 +0000
commit37712f2a7bde02580b9dd2ab99ef99029ce8e987 (patch)
tree58847a79c6e078ad75d8fd5722522df39371e5b6 /bin/stty
parentd700586c3a00b382aefb4b3787169e6a03ee05fb (diff)
Notes
Diffstat (limited to 'bin/stty')
-rw-r--r--bin/stty/stty.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/stty/stty.c b/bin/stty/stty.c
index d8ce2ffb76da..9d9f67970b07 100644
--- a/bin/stty/stty.c
+++ b/bin/stty/stty.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: stty.c,v 1.3 1995/04/29 15:00:34 bde Exp $
+ * $Id: stty.c,v 1.4 1995/05/30 00:07:28 rgrimes Exp $
*/
#ifndef lint
@@ -95,10 +95,12 @@ main(argc, argv)
args: argc -= optind;
argv += optind;
+ if (tcgetattr(i.fd, &i.t) < 0) {
+ warn("tcgetattr: not running on a terminal");
+ exit(1);
+ }
if (ioctl(i.fd, TIOCGETD, &i.ldisc) < 0)
err(1, "TIOCGETD");
- if (tcgetattr(i.fd, &i.t) < 0)
- err(1, "tcgetattr");
if (ioctl(i.fd, TIOCGWINSZ, &i.win) < 0)
warn("TIOCGWINSZ: %s\n", strerror(errno));