chiark / gitweb /
test-dhcp-client: open a real udp socket for test execution
[elogind.git] / src / nss-mymachines / nss-mymachines.c
index c87f436aea90c3de536caaedf4748f3149fa3a50..9476ad1694f2be8d52a6613e46692786c5541b6b 100644 (file)
@@ -39,7 +39,7 @@ static int count_addresses(sd_bus_message *m, int af, unsigned *ret) {
         assert(m);
         assert(ret);
 
-        while ((r = sd_bus_message_enter_container(m, 'r', "yay")) > 0) {
+        while ((r = sd_bus_message_enter_container(m, 'r', "iay")) > 0) {
                 int family;
 
                 r = sd_bus_message_read(m, "i", &family);
@@ -289,10 +289,7 @@ enum nss_status _nss_mymachines_gethostbyname3_r(
         alen = FAMILY_ADDRESS_SIZE(af);
         l = strlen(name);
 
-        ms = ALIGN(l+1) +
-                sizeof(char*) +
-                (c > 0 ? c : 1) * ALIGN(alen) +
-                (c > 0 ? c+1 : 2) * sizeof(char*);
+        ms = ALIGN(l+1) + c * ALIGN(alen) + (c+2) * sizeof(char*);
 
         if (buflen < ms) {
                 *errnop = ENOMEM;