]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc_unshare: fix network device handling 3897/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 5 Jul 2021 10:19:31 +0000 (12:19 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 5 Jul 2021 10:19:31 +0000 (12:19 +0200)
We were passing the wrong PID. Fix this!

Link: https://discuss.linuxcontainers.org/t/problem-with-moving-interface-new-network-namespace-in-lxc-unshare
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/tools/lxc_unshare.c

index 8e4716cf3a8f84e78abe821da8360370d3c930d4..a0ef5f618f3de8ee6604345d4fe2d33b478d630e 100644 (file)
@@ -416,7 +416,7 @@ int main(int argc, char *argv[])
                        if (lpid == 0) {
                                char buf[256];
 
-                               ret = snprintf(buf, 256, "%d", lpid);
+                               ret = snprintf(buf, 256, "%d", pid);
                                if (ret < 0 || ret >= 256)
                                        _exit(EXIT_FAILURE);
 
@@ -425,8 +425,7 @@ int main(int argc, char *argv[])
                        }
 
                        if (wait_for_pid(lpid) != 0)
-                               SYSERROR("Could not move interface \"%s\" into container %d",
-                                        ifname, lpid);
+                               SYSERROR("Could not move interface \"%s\" into container %d", ifname, lpid);
                }
 
                free_ifname_list();