]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Avoid using sizeof for hostname length check
authorRoy Marples <roy@marples.name>
Fri, 11 May 2007 21:31:14 +0000 (21:31 +0000)
committerRoy Marples <roy@marples.name>
Fri, 11 May 2007 21:31:14 +0000 (21:31 +0000)
dhcpcd.c

index 417b3d43104ecce47f6970a59e1c9fe8ca3922dc..5f264413abac300c8d15a23d156fdb92c18ca3ec 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -188,9 +188,9 @@ int main(int argc, char **argv)
                                }
                                break;
                        case 'h':
-                               if (strlen (optarg) > sizeof (options.hostname)) {
-                                       logger (LOG_ERR, "`%s' too long for HostName string, max is %lu",
-                                                       optarg, sizeof (options.hostname));
+                               if (strlen (optarg) > MAXHOSTNAMELEN) {
+                                       logger (LOG_ERR, "`%s' too long for HostName string, max is %d",
+                                                       optarg, MAXHOSTNAMELEN);
                                        exit (EXIT_FAILURE);
                                } else
                                        strlcpy (options.hostname, optarg, sizeof (options.hostname));