Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!ames!lll-tis!elxsi!marduk!gww From: gww@marduk.UUCP (Gary Winiger) Newsgroups: comp.bugs.4bsd Subject: Who always reports that it can't open utmp. +Fix Message-ID: <505@elxsi.UUCP> Date: Fri, 4-Sep-87 17:43:35 EDT Article-I.D.: elxsi.505 Posted: Fri Sep 4 17:43:35 1987 Date-Received: Sat, 5-Sep-87 20:49:53 EDT Sender: nobody@elxsi.UUCP Reply-To: gww@marduk.UUCP (Gary Winiger) Organization: ELXSI Super Computers, San Jose Lines: 64 Subject: Who always reports that it can't open utmp. +Fix Index: bin/who.c 4.2BSD +Fix Description: When who is called with an alternate ``utmp'' file that does not exist. It reports that it cannot open utmp when in fact it isn't trying to open utmp, but rather ``utmp'' the file the caller requested. Repeat-By: who /etc/foo Fix: The following code corrects this problem at Elxsi. Gary.. {ucbvax!sun,lll-lcc!lll-tis,amdahl!altos86,bridge2}!elxsi!gww --------- cut --------- snip --------- :.,$w diff ------------- *** /tmp/,RCSt1001827 Thu Dec 18 16:44:28 1986 --- who.c Thu Dec 18 15:04:29 1986 *************** *** 1,5 **** --- 1,8 ---- /* * $Log: who.c,v $ + * Revision 1.2 86/12/18 15:04:13 gww + * Give the name of the actual ``utmp'' file used. + * * Revision 1.1 86/12/17 18:15:24 gww * Initial revision * *************** *** 17,23 **** #endif not lint #ifndef lint ! static char *ERcsId = "$Header: who.c,v 1.1 86/12/17 18:15:24 gww Exp $ ENIX BSD"; static char sccsid[] = "@(#)who.c 5.1 (Berkeley) 5/2/85"; #endif not lint --- 20,26 ---- #endif not lint #ifndef lint ! static char *ERcsId = "$Header: who.c,v 1.2 86/12/18 15:04:13 gww Exp $ ENIX BSD"; static char sccsid[] = "@(#)who.c 5.1 (Berkeley) 5/2/85"; #endif not lint *************** *** 67,73 **** } } if ((fi = fopen(s, "r")) == NULL) { ! puts("who: cannot open utmp"); exit(1); } while (fread((char *)&utmp, sizeof(utmp), 1, fi) == 1) { --- 70,76 ---- } } if ((fi = fopen(s, "r")) == NULL) { ! printf("who: cannot open %s\n", s); exit(1); } while (fread((char *)&utmp, sizeof(utmp), 1, fi) == 1) {