🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: mod.computers.ridge
Article #51

BUG in error return from ioctl()

#51
From: bogstad
Date: Thu, 10 Jul 1986 21:09
40 lines
1469 bytes
	The following program demonstrates a bug in the ioctl() support
for ROS 3.3 update 3.  When compiled and run normally it prints "worked"
to the terminal.  When run with standard output redirected to a file -
"foo > file" - an error message is reported by the ioctl() as expected.
Unfortunately the error message is #14, "Bad address" rather then the
correct #25, "Not a typewriter".

				Bill Bogstad
				bogstad@hopkins-eecs-bravo.arpa

P.S.  If somebody at Ridge is reading this please consider this
	a request for an SPR.

---cut here---

#include <stdio.h>
#include <termio.h>

char *progname;
extern int errno;

main(argc, argv)
int argc;
char *argv[];
{
	struct termio old;

	progname = *argv;

	if(ioctl(1, TCGETA, &old) == -1) {
		fprintf(stderr, "errno = %d\n", errno);
		perror(progname);
 		exit(1);
 	}

	printf("worked\n");

	exit(0);
}
Technical Details
Message-ID: <8607102154.AA26779@ucbvax.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!utzoo!decvax!decwrl!ucbvax!HOPKINS-EECS-BRAVO.ARPA!bogstad

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!decvax!decwrl!ucbvax!HOPKINS-EECS-BRAVO.ARPA!bogstad
From: bogstad@HOPKINS-EECS-BRAVO.ARPA.UUCP
Newsgroups: mod.computers.ridge
Subject: BUG in error return from ioctl()
Message-ID: <8607102154.AA26779@ucbvax.Berkeley.EDU>
Date: Thu, 10-Jul-86 17:09:01 EDT
Article-I.D.: ucbvax.8607102154.AA26779
Posted: Thu Jul 10 17:09:01 1986
Date-Received: Sat, 12-Jul-86 00:20:48 EDT
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The ARPA Internet
Lines: 40
Approved: info-ridge@hopkins-eecs-bravo.arpa