From owner-svn-src-head@freebsd.org Wed Feb 21 21:13:10 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57A19F00B9E; Wed, 21 Feb 2018 21:13:10 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0254C737BE; Wed, 21 Feb 2018 21:13:10 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F13301DD74; Wed, 21 Feb 2018 21:13:09 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LLD9KR011424; Wed, 21 Feb 2018 21:13:09 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LLD8pF011410; Wed, 21 Feb 2018 21:13:08 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802212113.w1LLD8pF011410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 21 Feb 2018 21:13:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329754 - in head/sbin/dhclient: . tests X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head/sbin/dhclient: . tests X-SVN-Commit-Revision: 329754 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 21:13:10 -0000 Author: asomers Date: Wed Feb 21 21:13:08 2018 New Revision: 329754 URL: https://svnweb.freebsd.org/changeset/base/329754 Log: dhclient: raise WARNS to 4 Mostly const-correctness fixes. There were also some variable-shadowing, unused variable, and a couple of sockaddr type-correctness changes. I also had trouble with cast-align warnings. I was able to prove that one of them was a false positive. But ultimately I had to disable the warning program-wide to deal with the others. Reviewed by: cem MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D14460 Modified: head/sbin/dhclient/Makefile head/sbin/dhclient/clparse.c head/sbin/dhclient/conflex.c head/sbin/dhclient/dhclient.c head/sbin/dhclient/dhcpd.h head/sbin/dhclient/dispatch.c head/sbin/dhclient/errwarn.c head/sbin/dhclient/hash.c head/sbin/dhclient/options.c head/sbin/dhclient/privsep.c head/sbin/dhclient/privsep.h head/sbin/dhclient/tables.c head/sbin/dhclient/tests/fake.c head/sbin/dhclient/tree.h Modified: head/sbin/dhclient/Makefile ============================================================================== --- head/sbin/dhclient/Makefile Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/Makefile Wed Feb 21 21:13:08 2018 (r329754) @@ -50,7 +50,8 @@ LIBADD+= cap_syslog CFLAGS+=-DWITH_CASPER .endif -WARNS?= 3 +WARNS?= 4 +NO_WCAST_ALIGN= yes HAS_TESTS= SUBDIR.${MK_TESTS}+= tests Modified: head/sbin/dhclient/clparse.c ============================================================================== --- head/sbin/dhclient/clparse.c Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/clparse.c Wed Feb 21 21:13:08 2018 (r329754) @@ -687,7 +687,7 @@ parse_option_decl(FILE *cfile, struct option_data *opt u_int8_t hunkbuf[1024]; unsigned hunkix = 0; char *vendor; - char *fmt; + const char *fmt; struct universe *universe; struct option *option; struct iaddr ip_addr; Modified: head/sbin/dhclient/conflex.c ============================================================================== --- head/sbin/dhclient/conflex.c Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/conflex.c Wed Feb 21 21:13:08 2018 (r329754) @@ -55,7 +55,7 @@ int lexchar; char *token_line; char *prev_line; char *cur_line; -char *tlname; +const char *tlname; int eol_token; static char line1[81]; @@ -78,7 +78,7 @@ static int read_num_or_name(int, FILE *); static int intern(char *, int); void -new_parse(char *name) +new_parse(const char *name) { tlname = name; lpos = line = 1; @@ -264,7 +264,7 @@ read_string(FILE *cfile) static int read_number(int c, FILE *cfile) { - int seenx = 0, token = NUMBER; + int seenx = 0, _token = NUMBER; unsigned i = 0; tokbuf[i++] = c; @@ -286,7 +286,7 @@ read_number(int c, FILE *cfile) tokbuf[i] = 0; tval = tokbuf; - return (token); + return (_token); } static int Modified: head/sbin/dhclient/dhclient.c ============================================================================== --- head/sbin/dhclient/dhclient.c Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/dhclient.c Wed Feb 21 21:13:08 2018 (r329754) @@ -91,7 +91,7 @@ cap_channel_t *capsyslog; time_t cur_time; time_t default_lease_time = 43200; /* 12 hours... */ -char *path_dhclient_conf = _PATH_DHCLIENT_CONF; +const char *path_dhclient_conf = _PATH_DHCLIENT_CONF; char *path_dhclient_db = NULL; int log_perror = 1; @@ -131,10 +131,10 @@ void routehandler(struct protocol *); void usage(void); int check_option(struct client_lease *l, int option); int check_classless_option(unsigned char *data, int len); -int ipv4addrs(char * buf); +int ipv4addrs(const char * buf); int res_hnok(const char *dn); int check_search(const char *srch); -char *option_as_string(unsigned int code, unsigned char *data, int len); +const char *option_as_string(unsigned int code, unsigned char *data, int len); int fork_privchld(int, int); #define ROUNDUP(a) \ @@ -201,26 +201,25 @@ uint8_t curbssid[6]; static void disassoc(void *arg) { - struct interface_info *ifi = arg; + struct interface_info *_ifi = arg; /* * Clear existing state. */ - if (ifi->client->active != NULL) { + if (_ifi->client->active != NULL) { script_init("EXPIRE", NULL); script_write_params("old_", - ifi->client->active); - if (ifi->client->alias) + _ifi->client->active); + if (_ifi->client->alias) script_write_params("alias_", - ifi->client->alias); + _ifi->client->alias); script_go(); } - ifi->client->state = S_INIT; + _ifi->client->state = S_INIT; } -/* ARGSUSED */ void -routehandler(struct protocol *p) +routehandler(struct protocol *p __unused) { char msg[2048], *addr; struct rt_msghdr *rtm; @@ -230,7 +229,7 @@ routehandler(struct protocol *p) struct ieee80211_join_event *jev; struct client_lease *l; time_t t = time(NULL); - struct sockaddr *sa; + struct sockaddr_in *sa; struct iaddr a; ssize_t n; int linkstat; @@ -254,13 +253,13 @@ routehandler(struct protocol *p) if (scripttime == 0 || t < scripttime + 10) break; - sa = get_ifa((char *)(ifam + 1), ifam->ifam_addrs); + sa = (struct sockaddr_in*)get_ifa((char *)(ifam + 1), ifam->ifam_addrs); if (sa == NULL) break; if ((a.len = sizeof(struct in_addr)) > sizeof(a.iabuf)) error("king bula sez: len mismatch"); - memcpy(a.iabuf, &((struct sockaddr_in *)sa)->sin_addr, a.len); + memcpy(a.iabuf, &sa->sin_addr, a.len); if (addr_eq(a, defaddr)) break; @@ -271,7 +270,7 @@ routehandler(struct protocol *p) if (l == NULL) /* added/deleted addr is not the one we set */ break; - addr = inet_ntoa(((struct sockaddr_in *)sa)->sin_addr); + addr = inet_ntoa(sa->sin_addr); if (rtm->rtm_type == RTM_NEWADDR) { /* * XXX: If someone other than us adds our address, @@ -946,7 +945,7 @@ dhcp(struct packet *packet) { struct iaddrlist *ap; void (*handler)(struct packet *); - char *type; + const char *type; switch (packet->packet_type) { case DHCPOFFER: @@ -984,7 +983,7 @@ dhcpoffer(struct packet *packet) struct client_lease *lease, *lp; int i; int arp_timeout_needed, stop_selecting; - char *name = packet->options[DHO_DHCP_MESSAGE_TYPE].len ? + const char *name = packet->options[DHO_DHCP_MESSAGE_TYPE].len ? "DHCPOFFER" : "BOOTREPLY"; /* If we're not receptive to an offer right now, or if the offer @@ -1993,7 +1992,7 @@ write_client_lease(struct interface_info *ip, struct c } void -script_init(char *reason, struct string_list *medium) +script_init(const char *reason, struct string_list *medium) { size_t len, mediumlen = 0; struct imsg_hdr hdr; @@ -2028,7 +2027,7 @@ script_init(char *reason, struct string_list *medium) } void -priv_script_init(char *reason, char *medium) +priv_script_init(const char *reason, char *medium) { struct interface_info *ip = ifi; @@ -2056,7 +2055,7 @@ priv_script_init(char *reason, char *medium) } void -priv_script_write_params(char *prefix, struct client_lease *lease) +priv_script_write_params(const char *prefix, struct client_lease *lease) { struct interface_info *ip = ifi; u_int8_t dbuf[1500], *dp = NULL; @@ -2196,7 +2195,7 @@ supersede: } void -script_write_params(char *prefix, struct client_lease *lease) +script_write_params(const char *prefix, struct client_lease *lease) { size_t fn_len = 0, sn_len = 0, pr_len = 0; struct imsg_hdr hdr; @@ -2460,8 +2459,8 @@ go_daemon(void) int check_option(struct client_lease *l, int option) { - char *opbuf; - char *sbuf; + const char *opbuf; + const char *sbuf; /* we use this, since this is what gets passed to dhclient-script */ @@ -2721,7 +2720,7 @@ check_search(const char *srch) * otherwise, return 0 */ int -ipv4addrs(char * buf) +ipv4addrs(const char * buf) { struct in_addr jnk; int count = 0; @@ -2739,7 +2738,7 @@ ipv4addrs(char * buf) } -char * +const char * option_as_string(unsigned int code, unsigned char *data, int len) { static char optbuf[32768]; /* XXX */ Modified: head/sbin/dhclient/dhcpd.h ============================================================================== --- head/sbin/dhclient/dhcpd.h Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/dhcpd.h Wed Feb 21 21:13:08 2018 (r329754) @@ -235,7 +235,7 @@ struct protocol { struct hash_bucket { struct hash_bucket *next; - unsigned char *name; + const unsigned char *name; int len; unsigned char *value; }; @@ -258,26 +258,27 @@ struct hash_table { /* options.c */ int cons_options(struct packet *, struct dhcp_packet *, int, struct tree_cache **, int, int, int, u_int8_t *, int); -char *pretty_print_option(unsigned int, +const char *pretty_print_option(unsigned int, unsigned char *, int, int, int); void do_packet(struct interface_info *, struct dhcp_packet *, int, unsigned int, struct iaddr, struct hardware *); /* errwarn.c */ extern int warnings_occurred; -void error(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -int warning(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -int note(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -int debug(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -int parse_warn(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +void error(const char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +int warning(const char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +int note(const char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +int debug(const char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +int parse_warn(const char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); /* conflex.c */ extern int lexline, lexchar; -extern char *token_line, *tlname; +extern char *token_line; +extern const char *tlname; extern char comments[4096]; extern int comment_index; extern int eol_token; -void new_parse(char *); +void new_parse(const char *); int next_token(char **, FILE *); int peek_token(char **, FILE *); @@ -321,7 +322,7 @@ void dispatch(void); void got_one(struct protocol *); void add_timeout(time_t, void (*)(void *), void *); void cancel_timeout(void (*)(void *), void *); -void add_protocol(char *, int, void (*)(struct protocol *), void *); +void add_protocol(const char *, int, void (*)(struct protocol *), void *); void remove_protocol(struct protocol *); int interface_link_status(char *); void interface_set_mtu_unpriv(int, u_int16_t); @@ -329,8 +330,8 @@ void interface_set_mtu_priv(char *, u_int16_t); /* hash.c */ struct hash_table *new_hash(void); -void add_hash(struct hash_table *, unsigned char *, int, unsigned char *); -unsigned char *hash_lookup(struct hash_table *, unsigned char *, int); +void add_hash(struct hash_table *, const unsigned char *, int, unsigned char *); +void *hash_lookup(struct hash_table *, unsigned char *, int); /* tables.c */ extern struct option dhcp_options[256]; @@ -358,7 +359,7 @@ char *piaddr(struct iaddr); /* dhclient.c */ extern cap_channel_t *capsyslog; -extern char *path_dhclient_conf; +extern const char *path_dhclient_conf; extern char *path_dhclient_db; extern time_t cur_time; extern int log_priority; @@ -393,12 +394,12 @@ void free_client_lease(struct client_lease *); void rewrite_client_leases(void); void write_client_lease(struct interface_info *, struct client_lease *, int); -void priv_script_init(char *, char *); -void priv_script_write_params(char *, struct client_lease *); +void priv_script_init(const char *, char *); +void priv_script_write_params(const char *, struct client_lease *); int priv_script_go(void); -void script_init(char *, struct string_list *); -void script_write_params(char *, struct client_lease *); +void script_init(const char *, struct string_list *); +void script_write_params(const char *, struct client_lease *); int script_go(void); void client_envadd(struct client_state *, const char *, const char *, const char *, ...); @@ -442,7 +443,7 @@ void parse_reject_statement(FILE *, struct client_conf /* privsep.c */ struct buf *buf_open(size_t); -int buf_add(struct buf *, void *, size_t); +int buf_add(struct buf *, const void *, size_t); int buf_close(int, struct buf *); ssize_t buf_read(int, void *, size_t); void dispatch_imsg(struct interface_info *, int); Modified: head/sbin/dhclient/dispatch.c ============================================================================== --- head/sbin/dhclient/dispatch.c Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/dispatch.c Wed Feb 21 21:13:08 2018 (r329754) @@ -49,10 +49,14 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include +/* Assert that pointer p is aligned to at least align bytes */ +#define assert_aligned(p, align) assert((((uintptr_t)p) & ((align) - 1)) == 0) + struct protocol *protocols; struct timeout *timeouts; static struct timeout *free_timeouts; @@ -73,7 +77,6 @@ void discover_interfaces(struct interface_info *iface) { struct ifaddrs *ifap, *ifa; - struct sockaddr_in foo; struct ifreq *tif; if (getifaddrs(&ifap) != 0) @@ -93,15 +96,30 @@ discover_interfaces(struct interface_info *iface) * and record it in a linked list. */ if (ifa->ifa_addr->sa_family == AF_LINK) { - struct sockaddr_dl *foo = - (struct sockaddr_dl *)ifa->ifa_addr; + struct sockaddr_dl *foo; + /* + * The implementation of getifaddrs should guarantee + * this alignment + */ + assert_aligned(ifa->ifa_addr, + _Alignof(struct sockaddr_dl)); +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wcast-align" +#endif + foo = (struct sockaddr_dl *)ifa->ifa_addr; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + iface->index = foo->sdl_index; iface->hw_address.hlen = foo->sdl_alen; iface->hw_address.htype = HTYPE_ETHER; /* XXX */ memcpy(iface->hw_address.haddr, LLADDR(foo), foo->sdl_alen); } else if (ifa->ifa_addr->sa_family == AF_INET) { + struct sockaddr_in foo; struct iaddr addr; memcpy(&foo, ifa->ifa_addr, sizeof(foo)); @@ -437,7 +455,7 @@ cancel_timeout(void (*where)(void *), void *what) /* Add a protocol to the list of protocols... */ void -add_protocol(char *name, int fd, void (*handler)(struct protocol *), +add_protocol(const char *name, int fd, void (*handler)(struct protocol *), void *local) { struct protocol *p; Modified: head/sbin/dhclient/errwarn.c ============================================================================== --- head/sbin/dhclient/errwarn.c Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/errwarn.c Wed Feb 21 21:13:08 2018 (r329754) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include "dhcpd.h" -static void do_percentm(char *obuf, size_t size, char *ibuf); +static void do_percentm(char *obuf, size_t size, const char *ibuf); static char mbuf[1024]; static char fbuf[1024]; @@ -60,7 +60,7 @@ int warnings_occurred; * Log an error message, then exit. */ void -error(char *fmt, ...) +error(const char *fmt, ...) { va_list list; @@ -94,7 +94,7 @@ error(char *fmt, ...) * Log a warning message... */ int -warning(char *fmt, ...) +warning(const char *fmt, ...) { va_list list; @@ -120,7 +120,7 @@ warning(char *fmt, ...) * Log a note... */ int -note(char *fmt, ...) +note(const char *fmt, ...) { va_list list; @@ -146,7 +146,7 @@ note(char *fmt, ...) * Log a debug message... */ int -debug(char *fmt, ...) +debug(const char *fmt, ...) { va_list list; @@ -172,10 +172,10 @@ debug(char *fmt, ...) * Find %m in the input string and substitute an error message string. */ static void -do_percentm(char *obuf, size_t size, char *ibuf) +do_percentm(char *obuf, size_t size, const char *ibuf) { char ch; - char *s = ibuf; + const char *s = ibuf; char *t = obuf; size_t prlen; size_t fmt_left; @@ -205,7 +205,7 @@ do_percentm(char *obuf, size_t size, char *ibuf) } int -parse_warn(char *fmt, ...) +parse_warn(const char *fmt, ...) { va_list list; static char spaces[] = Modified: head/sbin/dhclient/hash.c ============================================================================== --- head/sbin/dhclient/hash.c Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/hash.c Wed Feb 21 21:13:08 2018 (r329754) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); #include "dhcpd.h" -static int do_hash(unsigned char *, int, int); +static int do_hash(const unsigned char *, int, int); struct hash_table * new_hash(void) @@ -62,9 +62,9 @@ new_hash(void) } static int -do_hash(unsigned char *name, int len, int size) +do_hash(const unsigned char *name, int len, int size) { - unsigned char *s = name; + const unsigned char *s = name; int accum = 0, i = len; while (i--) { @@ -77,7 +77,7 @@ do_hash(unsigned char *name, int len, int size) return (accum % size); } -void add_hash(struct hash_table *table, unsigned char *name, int len, +void add_hash(struct hash_table *table, const unsigned char *name, int len, unsigned char *pointer) { struct hash_bucket *bp; @@ -86,7 +86,7 @@ void add_hash(struct hash_table *table, unsigned char if (!table) return; if (!len) - len = strlen((char *)name); + len = strlen((const char *)name); hashno = do_hash(name, len, table->hash_count); bp = new_hash_bucket(); @@ -102,7 +102,7 @@ void add_hash(struct hash_table *table, unsigned char table->buckets[hashno] = bp; } -unsigned char * +void * hash_lookup(struct hash_table *table, unsigned char *name, int len) { struct hash_bucket *bp; Modified: head/sbin/dhclient/options.c ============================================================================== --- head/sbin/dhclient/options.c Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/options.c Wed Feb 21 21:13:08 2018 (r329754) @@ -628,7 +628,7 @@ store_options(unsigned char *buffer, int buflen, struc /* * Format the specified option so that a human can easily read it. */ -char * +const char * pretty_print_option(unsigned int code, unsigned char *data, int len, int emit_commas, int emit_quotes) { Modified: head/sbin/dhclient/privsep.c ============================================================================== --- head/sbin/dhclient/privsep.c Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/privsep.c Wed Feb 21 21:13:08 2018 (r329754) @@ -39,7 +39,7 @@ buf_open(size_t len) } int -buf_add(struct buf *buf, void *data, size_t len) +buf_add(struct buf *buf, const void *data, size_t len) { if (buf->wpos + len > buf->size) return (-1); Modified: head/sbin/dhclient/privsep.h ============================================================================== --- head/sbin/dhclient/privsep.h Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/privsep.h Wed Feb 21 21:13:08 2018 (r329754) @@ -46,6 +46,6 @@ struct imsg_hdr { }; struct buf *buf_open(size_t); -int buf_add(struct buf *, void *, size_t); +int buf_add(struct buf *, const void *, size_t); int buf_close(int, struct buf *); ssize_t buf_read(int sock, void *, size_t); Modified: head/sbin/dhclient/tables.c ============================================================================== --- head/sbin/dhclient/tables.c Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/tables.c Wed Feb 21 21:13:08 2018 (r329754) @@ -440,11 +440,11 @@ initialize_universes(void) for (i = 0; i < 256; i++) { dhcp_universe.options[i] = &dhcp_options[i]; add_hash(dhcp_universe.hash, - (unsigned char *)dhcp_options[i].name, 0, + (const unsigned char *)dhcp_options[i].name, 0, (unsigned char *)&dhcp_options[i]); } universe_hash.hash_count = DEFAULT_HASH_SIZE; add_hash(&universe_hash, - (unsigned char *)dhcp_universe.name, 0, + (const unsigned char *)dhcp_universe.name, 0, (unsigned char *)&dhcp_universe); } Modified: head/sbin/dhclient/tests/fake.c ============================================================================== --- head/sbin/dhclient/tests/fake.c Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/tests/fake.c Wed Feb 21 21:13:08 2018 (r329754) @@ -9,7 +9,7 @@ extern jmp_buf env; void -error(char *fmt, ...) +error(const char *fmt, ...) { va_list ap; @@ -22,7 +22,7 @@ error(char *fmt, ...) } int -warning(char *fmt, ...) +warning(const char *fmt, ...) { va_list ap; @@ -39,7 +39,7 @@ warning(char *fmt, ...) } int -note(char *fmt, ...) +note(const char *fmt, ...) { int ret; va_list ap; Modified: head/sbin/dhclient/tree.h ============================================================================== --- head/sbin/dhclient/tree.h Wed Feb 21 21:04:46 2018 (r329753) +++ head/sbin/dhclient/tree.h Wed Feb 21 21:13:08 2018 (r329754) @@ -57,14 +57,14 @@ struct tree_cache { }; struct universe { - char *name; + const char *name; struct hash_table *hash; struct option *options[256]; }; struct option { - char *name; - char *format; + const char *name; + const char *format; struct universe *universe; unsigned char code; };