lxc_unshare: fix network device handling

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>
This commit is contained in:
Christian Brauner 2021-07-05 12:19:31 +02:00
parent ecd92dffbc
commit a1ac26802c
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View File

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