diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-07-15 11:56:09 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-07-15 12:18:45 +0200 |
commit | fa3f917a25a015b55087307321fac6bbcc7811f8 (patch) | |
tree | 9faa6c696cabcbe81db7cdaf5447c72f9cb5a321 /src/network | |
parent | network: introduce FORMAT_LIFETIME() (diff) | |
download | systemd-fa3f917a25a015b55087307321fac6bbcc7811f8.tar.xz systemd-fa3f917a25a015b55087307321fac6bbcc7811f8.zip |
network: slightly simplify log_address_debug()
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/networkd-address.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index c244175088..2d3f8ece2d 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -638,7 +638,6 @@ char *format_lifetime(char *buf, size_t l, uint32_t lifetime) { static void log_address_debug(const Address *address, const char *str, const Link *link) { _cleanup_free_ char *addr = NULL, *peer = NULL, *flags_str = NULL; - bool has_peer; assert(address); assert(str); @@ -648,15 +647,13 @@ static void log_address_debug(const Address *address, const char *str, const Lin return; (void) in_addr_to_string(address->family, &address->in_addr, &addr); - has_peer = in_addr_is_set(address->family, &address->in_addr_peer); - if (has_peer) + if (in_addr_is_set(address->family, &address->in_addr_peer)) (void) in_addr_to_string(address->family, &address->in_addr_peer, &peer); (void) address_flags_to_string_alloc(address->flags, address->family, &flags_str); log_link_debug(link, "%s address: %s%s%s/%u (valid %s, preferred %s), flags: %s", - str, strnull(addr), has_peer ? " peer " : "", - has_peer ? strnull(peer) : "", address->prefixlen, + str, strnull(addr), peer ? " peer " : "", strempty(peer), address->prefixlen, FORMAT_LIFETIME(address->cinfo.ifa_valid), FORMAT_LIFETIME(address->cinfo.ifa_prefered), strna(flags_str)); |