Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Jun 2018 01:29:54 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r335612 - head/sbin/dhclient
Message-ID:  <201806250129.w5P1Ts5H017125@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Mon Jun 25 01:29:54 2018
New Revision: 335612
URL: https://svnweb.freebsd.org/changeset/base/335612

Log:
  dhclient: recorrect __progname to getprogname()
  
  A more correct way to modernize code that uses __progname is to just
  replace each occurance of it with a call to getprogname(3)
  
  Reported by:	ian
  Reviewed by:	imp

Modified:
  head/sbin/dhclient/dhclient.c

Modified: head/sbin/dhclient/dhclient.c
==============================================================================
--- head/sbin/dhclient/dhclient.c	Sun Jun 24 23:19:31 2018	(r335611)
+++ head/sbin/dhclient/dhclient.c	Mon Jun 25 01:29:54 2018	(r335612)
@@ -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);
 }



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