svn commit: r335602 - head/sbin/dhclient

Ian Lepore ian at freebsd.org
Sun Jun 24 14:35:35 UTC 2018


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


More information about the svn-src-all mailing list