Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Jun 2018 17:35:32 -0700
From:      Eitan Adler <eadler@freebsd.org>
To:        Ian Lepore <ian@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r335602 - head/sbin/dhclient
Message-ID:  <CAF6rxgknmm_BAc1b6zQQ=WBhNkdwhnwo-fiZUK_UhSdwEBEHJQ@mail.gmail.com>
In-Reply-To: <1529850923.24573.69.camel@freebsd.org>
References:  <201806241323.w5ODNRW2037739@repo.freebsd.org> <1529850923.24573.69.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 24 June 2018 at 07:35, Ian Lepore <ian@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAF6rxgknmm_BAc1b6zQQ=WBhNkdwhnwo-fiZUK_UhSdwEBEHJQ>