From owner-freebsd-bugs Wed Jan 13 21:10:40 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id VAA17126 for freebsd-bugs-outgoing; Wed, 13 Jan 1999 21:10:40 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id VAA17118 for ; Wed, 13 Jan 1999 21:10:37 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id VAA03625; Wed, 13 Jan 1999 21:10:01 -0800 (PST) Date: Wed, 13 Jan 1999 21:10:01 -0800 (PST) Message-Id: <199901140510.VAA03625@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.ORG From: "Matthew D. Fuller" Subject: Re: bin/9471: msgs: /var/msgs/bounds: No such file or directory Reply-To: "Matthew D. Fuller" Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/9471; it has been noted by GNATS. From: "Matthew D. Fuller" 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