From 22b96f293f376110568d4464a1e54fc9731d418a Mon Sep 17 00:00:00 2001 From: jkh Date: Tue, 7 Jul 1998 12:02:59 +0000 Subject: msgs -p (and maybe other flags, too) gives misleading error messages, especially on a new install, where /var/msgs/bounds doesn't exist. I moved my bounds file out of the way to create this before and after on a quick 'n' dirty hack, which is probably the 23rd best way to do it, but it works: PR: 6963 Submitted by: Matthew Fuller --- usr.bin/msgs/msgs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'usr.bin/msgs') diff --git a/usr.bin/msgs/msgs.c b/usr.bin/msgs/msgs.c index 5540883..1bc3712 100644 --- a/usr.bin/msgs/msgs.c +++ b/usr.bin/msgs/msgs.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)msgs.c 8.2 (Berkeley) 4/28/95"; #endif static const char rcsid[] = - "$Id$"; + "$Id: msgs.c,v 1.9 1997/07/29 06:47:18 charnier Exp $"; #endif /* not lint */ /* @@ -169,6 +169,7 @@ int argc; char *argv[]; int rcback = 0; /* amount to back off of rcfirst */ int firstmsg = 0, nextmsg = 0, lastmsg = 0; int blast = 0; + struct stat buf; /* stat to check access of bounds */ FILE *bounds; #ifdef UNBUFFERED @@ -244,6 +245,11 @@ int argc; char *argv[]; * determine current message bounds */ snprintf(fname, sizeof(fname), "%s/%s", _PATH_MSGS, BOUNDS); + if (stat(fname, &buf) < 0) + { + perror(fname); + exit(1); + } bounds = fopen(fname, "r"); if (bounds != NULL) { -- cgit v1.1