summaryrefslogtreecommitdiffstats
path: root/usr.bin/msgs
diff options
context:
space:
mode:
authormjacob <mjacob@FreeBSD.org>1999-07-24 17:49:17 +0000
committermjacob <mjacob@FreeBSD.org>1999-07-24 17:49:17 +0000
commit5802e7035de496f28d7de6900bf0b359931ce9e0 (patch)
tree24ea2bc8cf3d2e7712f7ecdb9ee586c6c0cb7d4c /usr.bin/msgs
parent558efd38f37e8450da1981b6cb559d8f68a48021 (diff)
downloadFreeBSD-src-5802e7035de496f28d7de6900bf0b359931ce9e0.zip
FreeBSD-src-5802e7035de496f28d7de6900bf0b359931ce9e0.tar.gz
Apply suggested patch- seems reasonable.
PR: 12020 Submitted by: Matthew D. Fuller <fullermd@futuresouth.com>
Diffstat (limited to 'usr.bin/msgs')
-rw-r--r--usr.bin/msgs/msgs.113
-rw-r--r--usr.bin/msgs/msgs.c21
2 files changed, 29 insertions, 5 deletions
diff --git a/usr.bin/msgs/msgs.1 b/usr.bin/msgs/msgs.1
index 9bc857f..2efddec 100644
--- a/usr.bin/msgs/msgs.1
+++ b/usr.bin/msgs/msgs.1
@@ -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
diff --git a/usr.bin/msgs/msgs.c b/usr.bin/msgs/msgs.c
index 74aa339..ff09c9e 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: 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) {
OpenPOWER on IntegriCloud