Do not format USEC_INFINITY as NULL

systemctl would print 'CPUQuotaPerSecUSec=(null)' for no limit. This
does not look right.

Since USEC_INFINITY is one of the valid values, format_timespan()
could return NULL, and we should wrap every use of it in strna() or
similar. But most callers didn't do that, and it seems more robust to
return a string ("infinity") that makes sense most of the time, even
if in some places the result will not be grammatically correct.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2014-09-29 11:09:39 -04:00
parent ee26bcc038
commit b1d6dcf5a5
5 changed files with 28 additions and 16 deletions
+4 -8
View File
@@ -1475,12 +1475,10 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message,
case RTM_NEWADDR:
if (!address_dropped)
log_debug_link(link, "added address: %s/%u (valid for %s)",
buf, address->prefixlen,
strna(valid_str));
buf, address->prefixlen, valid_str);
else
log_debug_link(link, "updated address: %s/%u (valid for %s)",
buf, address->prefixlen,
strna(valid_str));
buf, address->prefixlen, valid_str);
LIST_PREPEND(addresses, link->addresses, address);
address = NULL;
@@ -1491,15 +1489,13 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message,
case RTM_DELADDR:
if (address_dropped) {
log_debug_link(link, "removed address: %s/%u (valid for %s)",
buf, address->prefixlen,
strna(valid_str));
buf, address->prefixlen, valid_str);
link_save(link);
} else
log_warning_link(link,
"removing non-existent address: %s/%u (valid for %s)",
buf, address->prefixlen,
strna(valid_str));
buf, address->prefixlen, valid_str);
break;
default: