]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Use correct hostname length.
authorRoy Marples <roy@marples.name>
Tue, 5 Aug 2008 22:06:11 +0000 (22:06 +0000)
committerRoy Marples <roy@marples.name>
Tue, 5 Aug 2008 22:06:11 +0000 (22:06 +0000)
dhcpcd.c

index 85e99d22ae3d878b659a98fdb9d53214a7bca843..4a4a73feb42b31b76b57d477370b25d32804f35c 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -854,9 +854,11 @@ main(int argc, char **argv)
                }
        }
 
-       if ((p = strchr(options->hostname, '.'))) {
-               if (options->fqdn == FQDN_DISABLE)
+       if ((p = strchr(options->hostname + 1, '.'))) {
+               if (options->fqdn == FQDN_DISABLE) {
                        *p = '\0';
+                       options->hostname[0] = strlen(options->hostname + 1);
+               }
        } else {
                if (options->fqdn != FQDN_DISABLE) {
                        logger(LOG_WARNING, "hostname `%s' is not a FQDN",