summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2014-12-10 16:17:31 +0200
committerTom Gundersen <teg@jklm.no>2014-12-10 18:31:21 +0100
commitfab15fec2413bbc15dc7c24724ec82e371c966ba (patch)
tree441b2341171d02e9cab934cb27d2340a2db73b9d
parentc47e8936a43ce546e8a74fa569e9fbfae6c64be7 (diff)
sd-dhcp6-lease: Return only -EINVAL when a NULL lease is supplied
Suppyling a NULL lease is not a condition that needs to be asserted, returning -EINVAL is informative enough to the caller. This simplifies calling code and doesn't falsely indicate that something erroneous was attempted.
-rw-r--r--src/libsystemd-network/sd-dhcp6-lease.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libsystemd-network/sd-dhcp6-lease.c b/src/libsystemd-network/sd-dhcp6-lease.c
index e2715ea659..8960fac92f 100644
--- a/src/libsystemd-network/sd-dhcp6-lease.c
+++ b/src/libsystemd-network/sd-dhcp6-lease.c
@@ -110,9 +110,11 @@ int dhcp6_lease_set_preference(sd_dhcp6_lease *lease, uint8_t preference) {
}
int dhcp6_lease_get_preference(sd_dhcp6_lease *lease, uint8_t *preference) {
- assert_return(lease, -EINVAL);
assert_return(preference, -EINVAL);
+ if (!lease)
+ return -EINVAL;
+
*preference = lease->preference;
return 0;