lxc-user-nic: delete link on failure

parent 2b333aee
...@@ -992,6 +992,8 @@ int main(int argc, char *argv[]) ...@@ -992,6 +992,8 @@ int main(int argc, char *argv[])
/* Now rename the link. */ /* Now rename the link. */
if (rename_in_ns(pid, cnic, &vethname) < 0) { if (rename_in_ns(pid, cnic, &vethname) < 0) {
usernic_error("%s", "Failed to rename the link.\n"); 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); exit(EXIT_FAILURE);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment