From: naddy Date: Mon, 12 Oct 2015 19:53:58 +0000 (+0000) Subject: When isatty() was switched to F_ISATTY, the inline copy in ttyname() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=700ad8903a84996aa5be3b7e302c0093c903dd2f;p=openbsd When isatty() was switched to F_ISATTY, the inline copy in ttyname() was forgotten. Just call isatty(). ok deraadt@ --- diff --git a/lib/libc/gen/ttyname.c b/lib/libc/gen/ttyname.c index f54ddf09d30..9e8580c52a8 100644 --- a/lib/libc/gen/ttyname.c +++ b/lib/libc/gen/ttyname.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ttyname.c,v 1.15 2015/09/12 14:56:50 guenther Exp $ */ +/* $OpenBSD: ttyname.c,v 1.16 2015/10/12 19:53:58 naddy Exp $ */ /* * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -68,7 +67,6 @@ int ttyname_r(int fd, char *buf, size_t len) { struct stat sb; - struct termios ttyb; DB *db; DBT data, key; struct { @@ -77,7 +75,7 @@ ttyname_r(int fd, char *buf, size_t len) } bkey; /* Must be a terminal. */ - if (tcgetattr(fd, &ttyb) < 0) + if (!isatty(fd)) return (errno); /* Must be a character device. */ if (fstat(fd, &sb))