Date: 25 Mar 2002 18:16:34 +0100 From: Dag-Erling Smorgrav <des@ofug.org> To: Mark Murray <mark@grondar.za> Cc: Bruce Evans <bde@zeta.org.au>, audit@FreeBSD.ORG Subject: Re: src/lib __progname cleanup ; review please Message-ID: <xzpsn6oa7pp.fsf@flood.ping.uio.no> In-Reply-To: <200203251238.g2PCc8xG002769@grimreaper.grondar.org> References: <20020325221929.W879-100000@gamplex.bde.org> <200203251238.g2PCc8xG002769@grimreaper.grondar.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Mark Murray <mark@grondar.za> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpsn6oa7pp.fsf>