Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Apr 2001 09:03:25 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Chris Faulhaber <jedgar@fxp.org>
Cc:        Maxime Henrion <mux@qualys.com>, audit@FreeBSD.ORG
Subject:   Re: [PATCH] wall.c changes from OpenBSD
Message-ID:  <Pine.BSF.4.21.0104280849140.5874-100000@besplex.bde.org>
In-Reply-To: <20010427092403.A32859@peitho.fxp.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 27 Apr 2001, Chris Faulhaber wrote:

> On Fri, Apr 27, 2001 at 03:04:36PM +0200, Maxime Henrion wrote:
> > This patch makes wall open the file with the egid, as taken from the
> > OpenBSD mbox of Kris.  I changed several err() to errx() and added some
> > dots to end of sentences to match OpenBSD and reduce the diffs.
> 
> I disagree with the err() -> errx() changes.  Since err() prints the
> error message from strerror() whereas errx() does not, this patch
> removes this reporting ensuring the user will not be informed of the
> actual error.
> 
> The other change(s) look ok, though.

The err() changes are also wrong because they add "."s to the messages.
Error messages are not normally terminated with a ".".  (I could only
find one involving err[x]() in /usr/src/bin/*/*.c.)

> *** wall.c.old	Fri Apr 27 14:58:30 2001
> --- wall.c	Fri Apr 27 14:58:09 2001
> ***************
> *** 225,232 ****
>   	}
>   	(void)fprintf(fp, "%79s\r\n", " ");
>   
> ! 	if (fname && !(freopen(fname, "r", stdin)))
> ! 		err(1, "can't read %s", fname);
>   	while (fgets(lbuf, sizeof(lbuf), stdin))
>   		for (cnt = 0, p = lbuf; (ch = *p) != '\0'; ++p, ++cnt) {
>   			if (ch == '\r') {
> --- 225,238 ----
>   	}
>   	(void)fprintf(fp, "%79s\r\n", " ");
>   
> ! 	if (fname) {
> ! 		gid_t egid = getegid();

Style bugs:
1) declaration in inner block.
2) initializer in auto declaration.  Explicitly forbidden in style(9) since
   it calls a function.

> ! 
> ! 		setegid(getgid());
> ! 		if (freopen(fname, "r", stdin) == NULL)
> ! 			errx(1, "can't read %s.", fname);

errx() and "." in new code.

> ! 		setegid(egid);
> ! 	}
>   	while (fgets(lbuf, sizeof(lbuf), stdin))
>   		for (cnt = 0, p = lbuf; (ch = *p) != '\0'; ++p, ++cnt) {
>   			if (ch == '\r') {

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0104280849140.5874-100000>