]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
network: fix network device removal 2922/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 2 Apr 2019 21:26:59 +0000 (23:26 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 2 Apr 2019 21:26:59 +0000 (23:26 +0200)
Closes #2849.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/network.c

index fc3a8740d6604a3bd7c58866648ac6cce4175d29..d1b4d43ada70c036591581eab696bde02a707efd 100644 (file)
@@ -2574,17 +2574,16 @@ bool lxc_delete_network_priv(struct lxc_handler *handler)
                 * interface to the network namespace, we have to destroy it.
                 */
                ret = lxc_netdev_delete_by_index(netdev->ifindex);
-               if (-ret == ENODEV) {
-                       INFO("Interface \"%s\" with index %d already "
-                            "deleted or existing in different network "
-                            "namespace",
-                            netdev->name[0] != '\0' ? netdev->name : "(null)",
-                            netdev->ifindex);
-               } else if (ret < 0) {
-                       WARN("Failed to remove interface \"%s\" with index %d",
+               if (ret < 0) {
+                       if (errno != ENODEV) {
+                               WARN("Failed to remove interface \"%s\" with index %d",
+                                    netdev->name[0] != '\0' ? netdev->name : "(null)",
+                                    netdev->ifindex);
+                               goto clear_ifindices;
+                       }
+                       INFO("Interface \"%s\" with index %d already deleted or existing in different network namespace",
                             netdev->name[0] != '\0' ? netdev->name : "(null)",
                             netdev->ifindex);
-                       goto clear_ifindices;
                }
                INFO("Removed interface \"%s\" with index %d",
                     netdev->name[0] != '\0' ? netdev->name : "(null)",