summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/isatty.c
diff options
context:
space:
mode:
authorkurt <kurt@openbsd.org>2007-05-23 18:30:07 +0000
committerkurt <kurt@openbsd.org>2007-05-23 18:30:07 +0000
commit99965f212083ea2e2175eb90a25b5f8eb91191d5 (patch)
tree0b90210f9d97339e6dbdc745c6447972c5ff8f99 /lib/libc/gen/isatty.c
parentAdd hack to prevent switching to serial console on four-digit B/C/J class (diff)
downloadwireguard-openbsd-99965f212083ea2e2175eb90a25b5f8eb91191d5.tar.xz
wireguard-openbsd-99965f212083ea2e2175eb90a25b5f8eb91191d5.zip
Remove unnecessary locking. There is no need for serializing calls to
these functions and each use of the fd is already protected. No externally visible changes. okay marc@ millert@
Diffstat (limited to 'lib/libc/gen/isatty.c')
-rw-r--r--lib/libc/gen/isatty.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/lib/libc/gen/isatty.c b/lib/libc/gen/isatty.c
index a4c34d8b5c3..1915c6c3392 100644
--- a/lib/libc/gen/isatty.c
+++ b/lib/libc/gen/isatty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isatty.c,v 1.6 2005/08/08 08:05:34 espie Exp $ */
+/* $OpenBSD: isatty.c,v 1.7 2007/05/23 18:30:07 kurt Exp $ */
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -29,20 +29,11 @@
*/
#include <termios.h>
-#include <unistd.h>
-#include "thread_private.h"
int
isatty(int fd)
{
- int retval;
struct termios t;
- if (_FD_LOCK(fd, FD_READ, NULL) == 0) {
- retval = (tcgetattr(fd, &t) != -1);
- _FD_UNLOCK(fd, FD_READ);
- } else {
- retval = 0;
- }
- return(retval);
+ return (tcgetattr(fd, &t) != -1);
}