chiark / gitweb /
sd-dhcp6-client: Make end of successfull option parsing explicit
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Wed, 10 Dec 2014 14:17:30 +0000 (16:17 +0200)
committerTom Gundersen <teg@jklm.no>
Wed, 10 Dec 2014 17:31:21 +0000 (18:31 +0100)
When all DHCPv6 options have been parsed, dhcp6_option_parse() returns
-ENOMSG. Explicitely set the return value to indicate success so that
later code does not need to take this special value into account.

src/libsystemd-network/sd-dhcp6-client.c

index 8537d7cc86434f004f90ea365a343dc3882c6fe7..cc5b74416ffdb6dcffe02be90f0e63da783318d5 100644 (file)
@@ -770,7 +770,10 @@ static int client_parse_message(sd_dhcp6_client *client,
                 }
         }
 
-        if ((r < 0 && r != -ENOMSG) || !clientid) {
+        if (r == -ENOMSG)
+                r = 0;
+
+        if (r < 0 || !clientid) {
                 log_dhcp6_client(client, "%s has incomplete options",
                                  dhcp6_message_type_to_string(message->type));
                 return -EINVAL;