From: Yu Watanabe Date: Mon, 19 Feb 2024 01:00:33 +0000 (+0900) Subject: sd-ndisc: allow to call sd_ndisc_router_get_lifetime() with NULL for 'ret' X-Git-Tag: v256-rc1~794^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=828b5dbf2ff7a31816da66b6b1196b41e04c3fa1;p=thirdparty%2Fsystemd.git sd-ndisc: allow to call sd_ndisc_router_get_lifetime() with NULL for 'ret' --- diff --git a/src/libsystemd-network/sd-ndisc-router.c b/src/libsystemd-network/sd-ndisc-router.c index fa22368c8f0..536ee8cdf22 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) {