Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Jun 2018 08:35:23 -0600
From:      Ian Lepore <ian@freebsd.org>
To:        Eitan Adler <eadler@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r335602 - head/sbin/dhclient
Message-ID:  <1529850923.24573.69.camel@freebsd.org>
In-Reply-To: <201806241323.w5ODNRW2037739@repo.freebsd.org>
References:  <201806241323.w5ODNRW2037739@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 2018-06-24 at 13:23 +0000, Eitan Adler wrote:
> Author: eadler
> Date: Sun Jun 24 13:23:27 2018
> New Revision: 335602
> URL: https://svnweb.freebsd.org/changeset/base/335602
> 
> Log:
>   dhclient: build with WARNS=6
>   
>   - add static in a number of places
>   - initialize __progname rather than rely on magical extern values
>   - use nitems() instead of manually spelling it out
>   - unshadow 'idi'
>   - teach 'error' that it is '__dead2'
>   - add missing 'break'

The changes related to __progname aren't correct. __progname is a bsd-
ism that goes back to at least 4.4BSD, including the need to locally
have an extern char* decl to use it. You changed it to a file-static
var definition without changing the name, and names beginning with a
double underbar belong to the implementation and shouldn't be used
locally.

A more correct way to modernize code that uses __progname is to just
replace each occurance of it with a call to getprogname(3) (and ensure
stdlib.h has been included where it's used). References to the program
name are typically not in performance-sensitive code so there's no need
to even have a local var. (I think in libc, getprogname() is
implemented as "return __progname").

-- Ian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1529850923.24573.69.camel>