summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2015-09-12 19:18:50 +0200
committerFrancis Dupont <fdupont@isc.org>2015-09-12 19:18:50 +0200
commit646acb59b4ca20967aff71a3b15f013b391e4376 (patch)
tree4d42a5d44de36e2c30684dca0a1f135ce0511653 /client
parent7da1ac2bc68d6e65ee240d3f98a9ed67483db804 (diff)
downloadisc-dhcp-646acb59b4ca20967aff71a3b15f013b391e4376.tar.gz
Merged #38692 (use program base name in (sys)log)
Diffstat (limited to 'client')
-rw-r--r--client/dhclient.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/client/dhclient.c b/client/dhclient.c
index be2af6ad..3a0c0611 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -37,6 +37,7 @@
#include <sys/time.h>
#include <sys/wait.h>
#include <limits.h>
+#include <isc/file.h>
#include <dns/result.h>
TIME default_lease_time = 43200; /* 12 hours... */
@@ -89,6 +90,8 @@ int wanted_ia_ta = 0;
int wanted_ia_pd = 0;
char *mockup_relay = NULL;
+char *progname = NULL;
+
void run_stateless(int exit_mode);
static void usage(void);
@@ -129,6 +132,12 @@ main(int argc, char **argv) {
#endif /* DHCPv6 */
char *s;
+#ifdef OLD_LOG_NAME
+ progname = "dhclient";
+#else
+ progname = argv[0];
+#endif
+
/* Initialize client globals. */
memset(&default_duid, 0, sizeof(default_duid));
@@ -145,7 +154,7 @@ main(int argc, char **argv) {
else if (fd != -1)
close(fd);
- openlog("dhclient", DHCP_LOG_OPTIONS, LOG_DAEMON);
+ openlog(isc_file_basename(progname), DHCP_LOG_OPTIONS, LOG_DAEMON);
#if !(defined(DEBUG) || defined(__CYGWIN32__))
setlogmask(LOG_UPTO(LOG_INFO));
@@ -750,7 +759,7 @@ static void usage()
log_info(url);
- log_fatal("Usage: dhclient "
+ log_fatal("Usage: %s "
#ifdef DHCPv6
"[-4|-6] [-SNTPI1dvrxi] [-nw] [-p <port>] [-D LL|LLT] \n"
#else /* DHCPv6 */
@@ -759,7 +768,8 @@ static void usage()
" [-s server-addr] [-cf config-file]\n"
" [-df duid-file] [-lf lease-file]\n"
" [-pf pid-file] [--no-pid] [-e VAR=val]\n"
- " [-sf script-file] [interface]");
+ " [-sf script-file] [interface]",
+ isc_file_basename(progname));
}
void run_stateless(int exit_mode)