diff options
author | jkh <jkh@FreeBSD.org> | 1998-07-07 12:02:59 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1998-07-07 12:02:59 +0000 |
commit | 22b96f293f376110568d4464a1e54fc9731d418a (patch) | |
tree | 9e0d6c7e2c98d1e865b314099abf6ade42849b39 | |
parent | 28e4ac22238a9a9805385427173865170bafb3d1 (diff) | |
download | FreeBSD-src-22b96f293f376110568d4464a1e54fc9731d418a.zip FreeBSD-src-22b96f293f376110568d4464a1e54fc9731d418a.tar.gz |
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 <fullermd@mortis.futuresouth.com>
-rw-r--r-- | usr.bin/msgs/msgs.c | 8 |
1 files changed, 7 insertions, 1 deletions
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) { |