diff options
Diffstat (limited to 'src/nspawn/nspawn.c')
-rw-r--r-- | src/nspawn/nspawn.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index ddf1c371a0..b118c739e8 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -1659,11 +1659,8 @@ static int setup_veth(pid_t pid, char iface_name[IFNAMSIZ], int *ifi) { /* Use two different interface name prefixes depending whether * we are in bridge mode or not. */ - if (arg_network_bridge) - memcpy(iface_name, "vb-", 3); - else - memcpy(iface_name, "ve-", 3); - strncpy(iface_name+3, arg_machine, IFNAMSIZ - 3); + snprintf(iface_name, IFNAMSIZ, "%s-%s", + arg_network_bridge ? "vb" : "ve", arg_machine); r = get_mac(&mac); if (r < 0) { |