diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-02-19 02:00:33 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-02-20 07:31:39 +0100 |
commit | 828b5dbf2ff7a31816da66b6b1196b41e04c3fa1 (patch) | |
tree | 90c7f633b96673a96c99199231b4d5a5daa0f645 /src/libsystemd-network/sd-ndisc-router.c | |
parent | sd-ndisc: introduce sd_ndisc_is_running() (diff) | |
download | systemd-828b5dbf2ff7a31816da66b6b1196b41e04c3fa1.tar.xz systemd-828b5dbf2ff7a31816da66b6b1196b41e04c3fa1.zip |
sd-ndisc: allow to call sd_ndisc_router_get_lifetime() with NULL for 'ret'
Diffstat (limited to '')
-rw-r--r-- | src/libsystemd-network/sd-ndisc-router.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libsystemd-network/sd-ndisc-router.c b/src/libsystemd-network/sd-ndisc-router.c index fa22368c8f..536ee8cdf2 100644 --- a/src/libsystemd-network/sd-ndisc-router.c +++ b/src/libsystemd-network/sd-ndisc-router.c @@ -303,10 +303,11 @@ int sd_ndisc_router_get_flags(sd_ndisc_router *rt, uint64_t *ret) { int sd_ndisc_router_get_lifetime(sd_ndisc_router *rt, uint64_t *ret) { assert_return(rt, -EINVAL); - assert_return(ret, -EINVAL); - *ret = rt->lifetime_usec; - return 0; + if (ret) + *ret = rt->lifetime_usec; + + return rt->lifetime_usec > 0; /* Indicate if the router is still valid or not. */ } int sd_ndisc_router_get_preference(sd_ndisc_router *rt, unsigned *ret) { |