networkd: fix and simplify format_lifetime()
We would copy "forever" into the buffer. This is a fairly common case, so let's do a microoptimization and return a static string. (All callers use the return pointer, so this works just as well.) The prefix "for " was not displayed, because the pointer to the part of the buffer after "for " was returned. (Maybe it's just me, but I find strpcpy() and associated functions really hard to use… I always have to look up what the do exactly and what the return value is.) A simple test is added.
Loading
Please register or sign in to comment