From: Christian Brauner Date: Mon, 5 Jul 2021 10:19:31 +0000 (+0200) Subject: lxc_unshare: fix network device handling X-Git-Tag: lxc-5.0.0~143^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3897%2Fhead;p=thirdparty%2Flxc.git 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 --- diff --git a/src/lxc/tools/lxc_unshare.c b/src/lxc/tools/lxc_unshare.c index 8e4716cf3..a0ef5f618 100644 --- a/src/lxc/tools/lxc_unshare.c +++ b/src/lxc/tools/lxc_unshare.c @@ -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();