Apply suggested patch- seems reasonable.

PR:		12020
Submitted by:	Matthew D. Fuller <fullermd@futuresouth.com>
This commit is contained in:
Matt Jacob 1999-07-24 17:49:17 +00:00
parent fad2f0e686
commit 0de83b4407
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=49061
2 changed files with 29 additions and 5 deletions

View File

@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)msgs.1 8.2 (Berkeley) 4/28/95
.\" $Id$
.\" $Id: msgs.1,v 1.6 1999/07/12 20:23:47 nik Exp $
.\"
.Dd April 28, 1995
.Dt MSGS 1
@ -118,7 +118,16 @@ is incorrect it can be fixed by removing it;
.Nm
will make a new
.Pa bounds
file the next time it is run.
file the next time it is run with the
.Fl s
option.
If
.Nm
is run with any option other than
.Fl s ,
an error will be displayed if
.Pa /var/msgs/bounds
does not exist.
.Pp
The
.Fl s

View File

@ -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: msgs.c,v 1.12 1998/07/09 14:06:54 ghelmer Exp $";
"$Id: msgs.c,v 1.13 1998/07/14 19:07:30 ghelmer Exp $";
#endif /* not lint */
/*
@ -246,8 +246,23 @@ int argc; char *argv[];
* determine current message bounds
*/
snprintf(fname, sizeof(fname), "%s/%s", _PATH_MSGS, BOUNDS);
if (stat(fname, &buf) < 0)
err(errno, "%s", fname);
/*
* Test access rights to the bounds file
* This can be a little tricky. if(send_msg), then
* we will create it. We assume that if(send_msg),
* then you have write permission there.
* Else, it better be there, or we bail.
*/
if (send_msg != YES) {
if (stat(fname, &buf) < 0) {
if (hush != YES) {
err(errno, "%s", fname);
} else {
exit(1);
}
}
}
bounds = fopen(fname, "r");
if (bounds != NULL) {