From owner-freebsd-audit Mon Mar 25 9:16:42 2002 Delivered-To: freebsd-audit@freebsd.org Received: from flood.ping.uio.no (flood.ping.uio.no [129.240.78.31]) by hub.freebsd.org (Postfix) with ESMTP id D2ADB37B400 for ; Mon, 25 Mar 2002 09:16:38 -0800 (PST) Received: by flood.ping.uio.no (Postfix, from userid 2602) id 682585346; Mon, 25 Mar 2002 18:16:34 +0100 (CET) X-URL: http://www.ofug.org/~des/ X-Disclaimer: The views expressed in this message do not necessarily coincide with those of any organisation or company with which I am or have been affiliated. To: Mark Murray Cc: Bruce Evans , audit@FreeBSD.ORG Subject: Re: src/lib __progname cleanup ; review please References: <20020325221929.W879-100000@gamplex.bde.org> <200203251238.g2PCc8xG002769@grimreaper.grondar.org> From: Dag-Erling Smorgrav Date: 25 Mar 2002 18:16:34 +0100 In-Reply-To: <200203251238.g2PCc8xG002769@grimreaper.grondar.org> Message-ID: Lines: 21 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Mark Murray writes: > > A version of getprogname() that is not in the application namespace > > should be used, since some members of the err() family are called > > internally in libc. Similarly elsewhere. This is even more imporartant > > in Standard functions like malloc() and getopt(). > I don't understand this. The name "getprogname" is in the application namespace. If an application that calls err(3) (directly or indirectly) defines a non-static function or variable called getprogname, then err(3) will use that instead of the "real" getprogname(), possibly with very unpleasant consequences. You should therefore rename getprogname() to _getprogname(), which is in the implementation namespace, use only _getprogname() internally in libc, and add getprogname() as a weak alias for _getprogname() like this: __weak_alias(getprogname, _getprogname) DES -- Dag-Erling Smorgrav - des@ofug.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message