Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!mit-eddie!genrad!decvax!decwrl!sun!gorodish!guy From: guy%gorodish@Sun.COM (Guy Harris) Newsgroups: comp.bugs.4bsd Subject: A couple of improvements to "getty" Message-ID: <11392@sun.uucp> Date: Wed, 14-Jan-87 06:58:48 EST Article-I.D.: sun.11392 Posted: Wed Jan 14 06:58:48 1987 Date-Received: Thu, 15-Jan-87 03:26:05 EST Sender: news@sun.uucp Lines: 48 Index: etc/getty/main.c 4.3BSD Description: 1) "getty" should reset non-blocking and asynchronous mode on a port when it starts the port up, just in case the last user of that port didn't leave the water closet in the same state that it found it. 2) "getty" should also log an error if the "exec" of the "login" program fails. Repeat-By: 1) Put a port with non-blocking or asynchronous mode and log off, then watch the fun when the next person tries to use it. 2) Put in a bogus "lo=" entry in "/etc/gettytab" for a port and note that the failure to exec the program is not noted. Fix: *** /arch/4.3/usr/src/etc/getty/main.c Sat Feb 1 13:52:26 1986 --- main.c Wed Jan 14 02:05:56 1987 *************** *** 166,171 **** --- 166,172 ---- tname = argv[1]; for (;;) { int ldisp = OTTYDISC; + int off = 0; gettable(tname, tabent, tabstrs); if (OPset || EPset || APset) *************** *** 172,177 **** --- 173,180 ---- APset++, OPset++, EPset++; setdefaults(); ioctl(0, TIOCFLUSH, 0); /* clear out the crap */ + ioctl(0, FIONBIO, &off); /* turn off non-blocking mode */ + ioctl(0, FIOASYNC, &off); /* ditto for asynchronous mode */ if (IS) tmode.sg_ispeed = speed(IS); else if (SP) *************** *** 236,241 **** --- 239,245 ---- env[i] = environ[i]; makeenv(&env[i]); execle(LO, "login", "-p", name, (char *) 0, env); + syslog(LOG_ERR, "%s: %m", LO); exit(1); } alarm(0);