svn commit: r335602 - head/sbin/dhclient

Eitan Adler eadler at freebsd.org
Mon Jun 25 00:36:04 UTC 2018


On 24 June 2018 at 07:35, Ian Lepore <ian at freebsd.org> wrote:
> 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,

Thanks!

Is this correct then?

Index: dhclient.c
===================================================================
--- dhclient.c (revision 335611)
+++ dhclient.c (working copy)
@@ -149,7 +149,6 @@ int fork_privchld(int, int);
 #define MIN_MTU 68

 static time_t scripttime;
-static char *__progname;

 int
 findproto(char *cp, int n)
@@ -379,12 +378,10 @@ main(int argc, char *argv[])
  pid_t otherpid;
  cap_rights_t rights;

- __progname = basename(argv[0]);
-
  init_casper();

  /* Initially, log errors to stderr as well as to syslogd. */
- cap_openlog(capsyslog, __progname, LOG_PID | LOG_NDELAY, DHCPD_LOG_FACILITY);
+ cap_openlog(capsyslog, getprogname(), LOG_PID | LOG_NDELAY,
DHCPD_LOG_FACILITY);
  cap_setlogmask(capsyslog, LOG_UPTO(LOG_DEBUG));

  while ((ch = getopt(argc, argv, "bc:dl:p:qu")) != -1)
@@ -566,7 +563,7 @@ void
 usage(void)
 {

- fprintf(stderr, "usage: %s [-bdqu] ", __progname);
+ fprintf(stderr, "usage: %s [-bdqu] ", getprogname());
  fprintf(stderr, "[-c conffile] [-l leasefile] interface\n");
  exit(1);
 }



-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams


More information about the svn-src-all mailing list