Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.bugs.4bsd Subject: sendmail and others print bogus `Not a typewriter' errors Message-ID: <8192@mimsy.UUCP> Date: Wed, 26-Aug-87 23:17:43 EDT Article-I.D.: mimsy.8192 Posted: Wed Aug 26 23:17:43 1987 Date-Received: Sat, 29-Aug-87 05:23:38 EDT Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 43 Index: lib/libc/gen/isatty.c 4.3BSD Fix Description: Calls to isatty(), such as those in stdio, can clobber errno, making later perror()s do strange things. There are no doubt other library routines that do the same, but this is one of the more obvious. Repeat-By: See, e.g., sendmail errors. Fix: I chose to change isatty() itself, rather than _flsbuf(). I doubt anything depends on errno==ENOTTY after isatty(n)==0. RCS file: RCS/isatty.c,v retrieving revision 1.1 retrieving revision 1.2 diff -c2 -r1.1 -r1.2 *** /tmp/,RCSt1007512 Wed Aug 26 23:13:55 1987 --- /tmp/,RCSt2007512 Wed Aug 26 23:13:55 1987 *************** *** 12,18 **** { struct sgttyb ttyb; ! if (ioctl(f, TIOCGETP, &ttyb) < 0) return(0); return(1); } --- 12,22 ---- { struct sgttyb ttyb; + extern int errno; + int olderr = errno; ! if (ioctl(f, TIOCGETP, &ttyb) < 0) { ! errno = olderr; return(0); + } return(1); } -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) Domain: chris@mimsy.umd.edu Path: seismo!mimsy!chris