Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83 (MC840302); site mcvax.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!mcvax!aeb
From: aeb@mcvax.UUCP (Andries Brouwer)
Newsgroups: net.bugs.4bsd,net.unix-wizards
Subject: Bug in isatty (BSD4.2)
Message-ID: <726@mcvax.UUCP>
Date: Thu, 27-Jun-85 13:36:22 EDT
Article-I.D.: mcvax.726
Posted: Thu Jun 27 13:36:22 1985
Date-Received: Sat, 29-Jun-85 00:32:33 EDT
Reply-To: aeb@mcvax.UUCP (Andries Brouwer)
Organization: CWI, Amsterdam
Lines: 23
Xref: watmath net.bugs.4bsd:1573 net.unix-wizards:13654

The following short C program

main(){
	extern int errno;

	errno = 0;
	putchar('\n');
	if(errno > 0)
		perror("perror");
}

gives unexpected results.
E.g.
	a.out | ...
gives the error message "Operation not supported on socket".
The reason is that putchar calls putc calls _flsbuf calls isatty
and isatty contains the code
	if(ioctl(f,TIOCGETP,&ttyb)<0)
		return(0);
Probably it should do errno = 0 before the return(0).

We noticed this bug because the new pic and eqn started to give
strange error messages.