chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
c47e893
)
sd-dhcp6-lease: Return only -EINVAL when a NULL lease is supplied
author
Patrik Flykt
<patrik.flykt@linux.intel.com>
Wed, 10 Dec 2014 14:17:31 +0000
(16:17 +0200)
committer
Tom Gundersen
<teg@jklm.no>
Wed, 10 Dec 2014 17:31:21 +0000
(18:31 +0100)
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.
src/libsystemd-network/sd-dhcp6-lease.c
patch
|
blob
|
history
diff --git
a/src/libsystemd-network/sd-dhcp6-lease.c
b/src/libsystemd-network/sd-dhcp6-lease.c
index e2715ea659d370168fbb92c1b0a5be32d280c8bc..8960fac92f2df372cfd99512b7e8ef63bb32e85e 100644
(file)
--- 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;