From 4444438e8ff628c37f0457cb702514889c99c334 Mon Sep 17 00:00:00 2001 From: Olaf Barthel Date: Wed, 16 Apr 2008 07:46:05 +0000 Subject: [PATCH] - isatty() now checks if the file descriptor refers to a real file before it calls IsInteractive() on it. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15188 87f5fb63-7c3d-0410-a384-fd976d0f7a62 --- library/changes | 2 ++ library/unistd_isatty.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/library/changes b/library/changes index 8d45ac8..68dca3f 100644 --- a/library/changes +++ b/library/changes @@ -1,3 +1,5 @@ +- isatty() no longer crashes if passed a socket rather than a file. + - Rewrote the GetRexxVar()/SetRexxVar() functions (mostly) in 'C', using available code as a reference. The 68k stubs currently only work for the 68k version of the library, and a solution for the OS4 build still needs to be found. The code diff --git a/library/unistd_isatty.c b/library/unistd_isatty.c index cac620b..8e1b227 100644 --- a/library/unistd_isatty.c +++ b/library/unistd_isatty.c @@ -1,5 +1,5 @@ /* - * $Id: unistd_isatty.c,v 1.9 2006-11-16 14:39:23 obarthel Exp $ + * $Id: unistd_isatty.c,v 1.10 2008-04-16 07:46:05 obarthel Exp $ * * :ts=4 * @@ -67,6 +67,12 @@ isatty(int file_descriptor) goto out; } + if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_SOCKET)) + { + __set_errno(ENOTTY); + goto out; + } + __fd_lock(fd); result = 1;