summaryrefslogtreecommitdiff
path: root/src/machine
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-09-28 21:19:07 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-09-29 03:37:06 +0900
commit01afd0f7f53f7807294ce7c008ecf8a043a920fe (patch)
tree3aa92ca8449a2a4222aa51e6e9a36d3ca1f7d24a /src/machine
parent1641c2b1123617f7be249bb7f2b2c408defb3b96 (diff)
downloadsystemd-01afd0f7f53f7807294ce7c008ecf8a043a920fe.tar.gz
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.
Diffstat (limited to 'src/machine')
-rw-r--r--src/machine/machinectl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index c3a2384f15..d18374dda0 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -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);