Date: Wed, 13 Jan 1999 21:10:01 -0800 (PST) From: "Matthew D. Fuller" <fullermd@futuresouth.com> To: freebsd-bugs@FreeBSD.ORG Subject: Re: bin/9471: msgs: /var/msgs/bounds: No such file or directory Message-ID: <199901140510.VAA03625@freefall.freebsd.org>
index | next in thread | raw e-mail
The following reply was made to PR bin/9471; it has been noted by GNATS.
From: "Matthew D. Fuller" <fullermd@futuresouth.com>
To: ru@ucb.crimea.ua, freebsd-gnats-submit@freebsd.org
Cc:
Subject: Re: bin/9471: msgs: /var/msgs/bounds: No such file or directory
Date: Wed, 13 Jan 1999 23:01:59 -0600
On Wed, Jan 13, 1999 at 04:20:01PM -0800, a little birdie told me that Matthew D. Fuller remarked
>
> Simply removing that check will introduce another bug (which was what I
> worked around in that patch). Looking at it now, I the flaw in it.
> However, since /var/msgs isn't world writable, that will die with an
> unhelpful error message if you, for instance, run msgs -p as a normal user
> in your login files. You'd need to add checks for that.
>
> I'll take a look at this later tonite and see if I can put together a
> nicer patch.
Here's a first stab:
ASSUMPTION: We only want to actually create the bounds file if we're
posting a message (thus, theoretically, we're root and can write
/var/msgs)
This also makes -f (quiet mode) just shut up and exit.
The manpage should be updated to reflect, I can throw together a patch if
this looks good.
Index: msgs.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/msgs/msgs.c,v
retrieving revision 1.13
diff -u -r1.13 msgs.c
--- msgs.c 1998/07/14 19:07:30 1.13
+++ msgs.c 1999/01/14 04:58:24
@@ -246,8 +246,14 @@
* determine current message bounds
*/
snprintf(fname, sizeof(fname), "%s/%s", _PATH_MSGS, BOUNDS);
- if (stat(fname, &buf) < 0)
- err(errno, "%s", fname);
+ 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) {
---
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
| Matthew Fuller http://www.over-yonder.net/~fullermd |
* fullermd@futuresouth.com fullermd@over-yonder.net *
| UNIX Systems Administrator Specializing in FreeBSD |
* FutureSouth Communications ISPHelp ISP Consulting *
| "The only reason I'm burning my candle at both ends, |
* because I haven't figured out how to light the *
| middle yet" |
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901140510.VAA03625>
