tree-wide: make format_ifname() or friends return negative errno on failure
Also, - drop unnecessary +1 from buffer size, as IF_NAMESIZE or IFNAMSIZ includes the nul at the end. - format_ifname() does not update buffer on failure, - introduces format_ifname_alloc(), FORMAT_IFNAME(), and their friends.
This commit is contained in:
@@ -557,9 +557,9 @@ static void print_machine_status_info(sd_bus *bus, MachineStatusInfo *i) {
|
||||
fputs("\t Iface:", stdout);
|
||||
|
||||
for (size_t c = 0; c < i->n_netif; c++) {
|
||||
char name[IF_NAMESIZE+1];
|
||||
char name[IF_NAMESIZE];
|
||||
|
||||
if (format_ifname(i->netif[c], name)) {
|
||||
if (format_ifname(i->netif[c], name) >= 0) {
|
||||
fputc(' ', stdout);
|
||||
fputs(name, stdout);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user