From: Christian Brauner Date: Sat, 11 Mar 2017 11:11:40 +0000 (+0100) Subject: lxc-user-nic: delete link on failure X-Git-Tag: lxc-2.1.0~184^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=54e9a0e13d31e0c11a72ce10dbcee2d4a2d09b2a;p=thirdparty%2Flxc.git lxc-user-nic: delete link on failure Signed-off-by: Christian Brauner --- diff --git a/src/lxc/lxc_user_nic.c b/src/lxc/lxc_user_nic.c index 2ebb3f2dc..c93b4cc70 100644 --- a/src/lxc/lxc_user_nic.c +++ b/src/lxc/lxc_user_nic.c @@ -992,6 +992,8 @@ int main(int argc, char *argv[]) /* Now rename the link. */ if (rename_in_ns(pid, cnic, &vethname) < 0) { usernic_error("%s", "Failed to rename the link.\n"); + if (lxc_netdev_delete_by_name(cnic) < 0) + usernic_error("Failed to delete link \"%s\" the link. Manual cleanup needed.\n", cnic); exit(EXIT_FAILURE); }