[net.bugs.v7] Pyramid 90X C program dumps core

ken@rochester.UUCP (De onbekende kat) (09/26/85)

 = BS1;
	r = 0;
	if (gtty(fd, buf) >= 0)
		++r;
#ifdef CLEAR
	zflg = (buf[2] & BS1) == 0;
#endif
	if (pipef
#ifdef V7
		  || getenv("FOO") == 0
#endif
					    )
		++r;
	return(r);
}
-- 
UUCP: ..!{allegra,decvax,seismo}!rochester!ken ARPA: ken@rochester.arpa
USnail:	Dept. of Comp. Sci., U. of Rochester, NY 14627. Voice: Ken!

ken@rochester.UUCP (De onbekende kat) (09/26/85)

Sorry, that should have been char *getenv(); in my last posting. The bug
remains though.

	Ken
-- 
UUCP: ..!{allegra,decvax,seismo}!rochester!ken ARPA: ken@rochester.arpa
USnail:	Dept. of Comp. Sci., U. of Rochester, NY 14627. Voice: Ken!

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (09/27/85)

> 	short buf[3];	/* naughty int's */
	sgttyb buf;
> 	char getenv();
	char *getenv();

and other changes accordingly.

chris@umcp-cs.UUCP (Chris Torek) (09/27/85)

``gtty'' should not be done on a ``short buf[3]'', ONLY on a ``struct
sgttyb''.  Why?  Because it is not the same on all machines.  In
particular, on a Pyramid 90x an sgttyb structure is about three
times bigger than on V7/4.2.

How about making the routine read:

	#include <sgtty.h>
	    .
	    .
	    .
	istty(fd)
	int fd;
	{
		register int r;
		struct sgttyb sg;
		char *getenv();		/* not ``char getenv();'' */

		sg.sg_flags = 0;	/* this is how BS1 was defined
					   in the original; but BS1 is
					   something else in sgtty.h. */
		r = 0;
		if (gtty(fd, &sg) >= 0)
			++r;
	#ifdef CLEAR
		zflg = (sg.sg_flags & 0) == 0;	/* this is always true */
					/* was & BS1 */
	#endif
		if (pipef
	#ifdef V7
			  || getenv("FOO") == 0
	#endif
						)
			++r;
		return (r);
	}
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@maryland