Skip to content

Commit

Permalink
lxc-user-nic: delete link on failure
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner authored and stgraber committed Mar 20, 2017
1 parent f6c0d0b commit 2bde6a9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lxc/lxc_user_nic.c
Expand Up @@ -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);
}

Expand Down

0 comments on commit 2bde6a9

Please sign in to comment.