Re: src/lib __progname cleanup ; review please

Dag-Erling Smorgrav <[email protected]>
Newsgroups gmane.os.freebsd.devel.audit
Message-ID <[email protected]>
Mark Murray <[email protected]> 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 - [email protected]

To Unsubscribe: send mail to [email protected]
with "unsubscribe freebsd-audit" in the body of the message
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.