X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=src%2Flxc%2Flxc_user_nic.c;h=2a5c3a43a09f3ac2dedc5d0508a249ed4e03a948;hb=0059379ff44bd52cf17d72300e60432686f2fba0;hp=5752935d0ca79f724294b93bad9453830563f2c2;hpb=bb196a1aa09560c46b7cda62d53bed9d3781c958;p=mirror_lxc.git diff --git a/src/lxc/lxc_user_nic.c b/src/lxc/lxc_user_nic.c index 5752935d0..2a5c3a43a 100644 --- a/src/lxc/lxc_user_nic.c +++ b/src/lxc/lxc_user_nic.c @@ -46,6 +46,7 @@ #include #include "config.h" +#include "namespace.h" #include "network.h" #include "utils.h" @@ -814,14 +815,16 @@ static char *lxc_secure_rename_in_ns(int pid, char *oldname, char *newname, int *container_veth_ifidx) { int ret; + pid_t pid_self; uid_t ruid, suid, euid; char ifname[IFNAMSIZ]; char *string_ret = NULL, *name = NULL; int fd = -1, ifindex = -1, ofd = -1; - ofd = lxc_preserve_ns(getpid(), "net"); + pid_self = lxc_raw_getpid(); + ofd = lxc_preserve_ns(pid_self, "net"); if (ofd < 0) { - usernic_error("Failed opening network namespace path for %d", getpid()); + usernic_error("Failed opening network namespace path for %d", pid_self); return NULL; } @@ -993,13 +996,15 @@ struct user_nic_args { static bool is_privileged_over_netns(int netns_fd) { int ret; + pid_t pid_self; uid_t euid, ruid, suid; bool bret = false; int ofd = -1; - ofd = lxc_preserve_ns(getpid(), "net"); + pid_self = lxc_raw_getpid(); + ofd = lxc_preserve_ns(pid_self, "net"); if (ofd < 0) { - usernic_error("Failed opening network namespace path for %d", getpid()); + usernic_error("Failed opening network namespace path for %d", pid_self); return false; }