diff options
author | Alex Crawford <alex.crawford@coreos.com> | 2015-07-31 21:48:47 -0700 |
---|---|---|
committer | Alex Crawford <alex.crawford@coreos.com> | 2015-08-05 09:00:57 -0700 |
commit | 9b57d9aee48e78bb591baecea1c3dbafd974759f (patch) | |
tree | e85339e11cbb8f6a82e62ecdfdbd542feefe5adf /src/libsystemd-network | |
parent | a073309fb779e9c9e48eaef664daeb6b8f6080da (diff) |
networkd: clean up duplicate code
Diffstat (limited to 'src/libsystemd-network')
-rw-r--r-- | src/libsystemd-network/sd-dhcp-lease.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c index 3d0c8ff890..0d1e3746aa 100644 --- a/src/libsystemd-network/sd-dhcp-lease.c +++ b/src/libsystemd-network/sd-dhcp-lease.c @@ -943,19 +943,13 @@ int sd_dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) { } if (client_id_hex) { - if (strlen(client_id_hex) % 2) - return -EINVAL; - - r = unhexmem(client_id_hex, strlen(client_id_hex), (void**) &lease->client_id, &lease->client_id_len); + r = deserialize_dhcp_option(&lease->client_id, &lease->client_id_len, client_id_hex); if (r < 0) return r; } if (vendor_specific_hex) { - if (strlen(vendor_specific_hex) % 2) - return -EINVAL; - - r = unhexmem(vendor_specific_hex, strlen(vendor_specific_hex), (void**) &lease->vendor_specific, &lease->vendor_specific_len); + r = deserialize_dhcp_option(&lease->vendor_specific, &lease->vendor_specific_len, vendor_specific_hex); if (r < 0) return r; } |