From: Roy Marples Date: Wed, 18 Apr 2007 15:14:55 +0000 (+0000) Subject: Use MAXHOSTNAMELEN instead of our define X-Git-Tag: v3.2.3~271 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e9e8a1d4b24a11ef393a5e51cdb3542b2bece4d;p=thirdparty%2Fdhcpcd.git Use MAXHOSTNAMELEN instead of our define --- diff --git a/configure.c b/configure.c index 01a6be28..20794b2c 100644 --- a/configure.c +++ b/configure.c @@ -505,8 +505,8 @@ int configure (const options_t *options, interface_t *iface, route_t *route = NULL; route_t *new_route = NULL; route_t *old_route = NULL; - char newhostname[HOSTNAME_MAX_LEN] = {0}; - char curhostname[HOSTNAME_MAX_LEN] = {0}; + char newhostname[MAXHOSTNAMELEN] = {0}; + char curhostname[MAXHOSTNAMELEN] = {0}; if (! options || ! iface || ! dhcp) return -1; diff --git a/dhcpcd.c b/dhcpcd.c index 908cfedb..7c87d54e 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -193,9 +193,9 @@ int main(int argc, char **argv) } break; case 'h': - if (strlen (optarg) > HOSTNAME_MAX_LEN) { + if (strlen (optarg) > sizeof (options.hostname)) { logger (LOG_ERR, "`%s' too long for HostName string, max is %d", - optarg, HOSTNAME_MAX_LEN); + optarg, sizeof (options.hostname)); exit (EXIT_FAILURE); } else strlcpy (options.hostname, optarg, sizeof (options.hostname)); diff --git a/dhcpcd.h b/dhcpcd.h index 41be5883..82066e00 100644 --- a/dhcpcd.h +++ b/dhcpcd.h @@ -34,12 +34,11 @@ #define CLASS_ID_MAX_LEN 48 #define CLIENT_ID_MAX_LEN 48 -#define HOSTNAME_MAX_LEN 255 -#define USERCLASS_MAX_LEN 255 +#define USERCLASS_MAX_LEN 255 typedef struct options_t { char interface[IF_NAMESIZE]; - char hostname[HOSTNAME_MAX_LEN]; + char hostname[MAXHOSTNAMELEN]; int fqdn; char classid[CLASS_ID_MAX_LEN]; char clientid[CLIENT_ID_MAX_LEN];