[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#649747: 127.0.1.1 hack is not supported by kFreeBSD



2011/11/23 Axel Beckert <abe@debian.org>:
> Seems as if it works:

Thanks for testing.  Patch updated.

-- 
Robert Millan
diff --git a/netcfg-common.c b/netcfg-common.c
index 4b2a8a0..6053a48 100644
--- a/netcfg-common.c
+++ b/netcfg-common.c
@@ -1042,19 +1042,23 @@ void netcfg_write_common(struct in_addr ipaddress, char *hostname, char *domain)
     if ((fp = file_open(HOSTS_FILE, "w"))) {
         char ptr1[INET_ADDRSTRLEN];
 
-        fprintf(fp, "127.0.0.1\tlocalhost\n");
+        fprintf(fp, "127.0.0.1\tlocalhost");
 
         if (ipaddress.s_addr) {
             inet_ntop (AF_INET, &ipaddress, ptr1, sizeof(ptr1));
             if (domain_nodot && !empty_str(domain_nodot))
-                fprintf(fp, "%s\t%s.%s\t%s\n", ptr1, hostname, domain_nodot, hostname);
+                fprintf(fp, "\n%s\t%s.%s\t%s\n", ptr1, hostname, domain_nodot, hostname);
             else
-                fprintf(fp, "%s\t%s\n", ptr1, hostname);
+                fprintf(fp, "\n%s\t%s\n", ptr1, hostname);
         } else {
+#ifndef __FreeBSD_kernel__
             if (domain_nodot && !empty_str(domain_nodot))
-                fprintf(fp, "127.0.1.1\t%s.%s\t%s\n", hostname, domain_nodot, hostname);
+                fprintf(fp, "\n127.0.1.1\t%s.%s\t%s\n", hostname, domain_nodot, hostname);
             else
-                fprintf(fp, "127.0.1.1\t%s\n", hostname);
+                fprintf(fp, "\n127.0.1.1\t%s\n", hostname);
+#else
+            fprintf(fp, "\t%s\n", hostname);
+#endif
         }
 
         fprintf(fp, "\n" IPV6_HOSTS);

Reply to: