From owner-freebsd-bugs Mon Mar 31 04:50:07 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id EAA15811 for bugs-outgoing; Mon, 31 Mar 1997 04:50:07 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id EAA15804; Mon, 31 Mar 1997 04:50:04 -0800 (PST) Resent-Date: Mon, 31 Mar 1997 04:50:04 -0800 (PST) Resent-Message-Id: <199703311250.EAA15804@freefall.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, blank@fox.uni-trier.de Received: from sliphost37.uni-trier.de (root@sliphost37.uni-trier.de [136.199.240.37]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id EAA15669 for ; Mon, 31 Mar 1997 04:45:20 -0800 (PST) Received: (from blank@localhost) by sliphost37.uni-trier.de (8.8.5/8.8.5) id OAA09728; Mon, 31 Mar 1997 14:42:44 +0200 (CEST) Message-Id: <199703311242.OAA09728@sliphost37.uni-trier.de> Date: Mon, 31 Mar 1997 14:42:44 +0200 (CEST) From: blank@fox.uni-trier.de Reply-To: blank@fox.uni-trier.de To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/3152: FreeBSD 2.2-STABLE: getty does not initialize %m, %s, %r and %v Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >Number: 3152 >Category: bin >Synopsis: FreeBSD 2.2-STABLE: getty does not initialize %m, %s, %r and %v >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Mar 31 04:50:02 PST 1997 >Last-Modified: >Originator: Sascha Blank >Organization: Computer Center of the University of Trier, Germany >Release: FreeBSD 2.2-STABLE i386 >Environment: FreeBSD 2.2-STABLE (current as of ctm-src-2.2 #0221) fgrep rcsid /usr/src/libexec/getty/main.c: static char rcsid[] = "$Id: main.c,v 1.10.2.2 1996/12/31 05:50:28 msmith Exp $"; >Description: gettytab(5) says there are macros %m, %s, %r and %v that one can use to display portions of the utsname structure in the initial banner message. I inserted the following line in /etc/gettytab to keep my banner message up to date: default:\ :cb:ce:ck:lc:fd#1000:im=\r\n %s %r (%h) (%t)\r\n\r\n:sp#1200: But getty printed (sliphost37.uni-trier.de) (vty00) instead of FreeBSD 2.2-STABLE (sliphost37.uni-trier.de) (vty00) >How-To-Repeat: Change /etc/gettytab to match the line above, log yourself out and watch, whether getty will print out all information. >Fix: The reason for the problem was easy to find. main.c declares struct utsname kerninfo; but actually never calls uname(3) to assign reasonable values to it. Therefore the four macros only print empty strings. The following small diff solves the problem. It calls uname(3) to initialize kerninfo. In the unexpected case that this fails, kerninfo is assigned some (more or less) reasonalbe default values. *** main.c.CURRENT Mon Mar 31 14:13:08 1997 --- main.c Mon Mar 31 14:18:21 1997 *************** *** 192,197 **** --- 192,205 ---- if (hostname[0] == '\0') strcpy(hostname, "Amnesiac"); + if (uname(&kerninfo) == -1) { + strcpy (kerninfo.sysname, "FreeBSD"); + strcpy (kerninfo.nodename, "unknown"); + strcpy (kerninfo.release, "unknown"); + strcpy (kerninfo.version, "unknown"); + strcpy (kerninfo.machine, "unknown"); + } + /* * Limit running time to deal with broken or dead lines. */ -- Sascha Blank - mailto:blank@fox.uni-trier.de Student and System Administrator at the University of Trier, Germany Finger my account to receive my Public PGP key I don't speak for my employers, they don't pay me enough for that. >Audit-Trail: >Unformatted: