]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Use MAXHOSTNAMELEN instead of our define
authorRoy Marples <roy@marples.name>
Wed, 18 Apr 2007 15:14:55 +0000 (15:14 +0000)
committerRoy Marples <roy@marples.name>
Wed, 18 Apr 2007 15:14:55 +0000 (15:14 +0000)
configure.c
dhcpcd.c
dhcpcd.h

index 01a6be285d68f8a3a431de1ef02e2cda71e58064..20794b2cf2c97564e14442f8791e018709e67823 100644 (file)
@@ -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;
index 908cfedb910a4b87f69bfafaff395a461b8d4593..7c87d54e73a10423ba9db49fac60304d7df7a886 100644 (file)
--- 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));
index 41be5883ec128d0cefaea53744672e69d2103483..82066e0037ecf40e92185be32bc8274df0846583 100644 (file)
--- a/dhcpcd.h
+++ b/dhcpcd.h
 
 #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];