aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/msgs
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1998-07-07 12:02:59 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1998-07-07 12:02:59 +0000
commit0b1778905fdebb8463ec0814610ec846ba23f01b (patch)
tree0fb978c5724d553121196deb1c26a8b2d84074ea /usr.bin/msgs
parent1d86f959b6ea5809b62b500bc32191299830e65a (diff)
downloadsrc-0b1778905fdebb8463ec0814610ec846ba23f01b.tar.gz
src-0b1778905fdebb8463ec0814610ec846ba23f01b.zip
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>
Notes
Notes: svn path=/head/; revision=37476
Diffstat (limited to 'usr.bin/msgs')
-rw-r--r--usr.bin/msgs/msgs.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.bin/msgs/msgs.c b/usr.bin/msgs/msgs.c
index 5540883c2992..1bc3712c64b6 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) {