Index: runtime/bin/socket_linux.cc |
diff --git a/runtime/bin/socket_linux.cc b/runtime/bin/socket_linux.cc |
index 33e632de0a9e9912d358fbd7143779783560c709..23e492c930f58bb6446b0fb26c896678816d27ad 100644 |
--- a/runtime/bin/socket_linux.cc |
+++ b/runtime/bin/socket_linux.cc |
@@ -147,9 +147,9 @@ void Socket::GetError(intptr_t fd, OSError* os_error) { |
int Socket::GetType(intptr_t fd) { |
struct stat buf; |
- if (isatty(fd)) return File::kTerminal; |
int result = fstat(fd, &buf); |
if (result == -1) return -1; |
+ if (S_ISCHR(buf.st_mode)) return File::kTerminal; |
if (S_ISFIFO(buf.st_mode)) return File::kPipe; |
if (S_ISREG(buf.st_mode)) return File::kFile; |
return File::kOther; |