Unverified Commit 06d390df by Christian Brauner Committed by GitHub

Merge pull request #2552 from tcharding/cpp-check

cmd: Lint with cppcheck
parents 86cea5d1 aac44dc4
...@@ -707,7 +707,6 @@ static char *get_nic_if_avail(int fd, struct alloted_s *names, int pid, ...@@ -707,7 +707,6 @@ static char *get_nic_if_avail(int fd, struct alloted_s *names, int pid,
char nicname[IFNAMSIZ]; char nicname[IFNAMSIZ];
struct stat sb; struct stat sb;
struct alloted_s *n; struct alloted_s *n;
int count = 0;
char *buf = NULL; char *buf = NULL;
for (n = names; n != NULL; n = n->next) for (n = names; n != NULL; n = n->next)
...@@ -735,6 +734,8 @@ static char *get_nic_if_avail(int fd, struct alloted_s *names, int pid, ...@@ -735,6 +734,8 @@ static char *get_nic_if_avail(int fd, struct alloted_s *names, int pid,
owner = NULL; owner = NULL;
for (n = names; n != NULL; n = n->next) { for (n = names; n != NULL; n = n->next) {
int count;
count = count_entries(buf, sb.st_size, n->name, intype, br); count = count_entries(buf, sb.st_size, n->name, intype, br);
if (count >= n->allowed) if (count >= n->allowed)
continue; continue;
...@@ -862,12 +863,12 @@ again: ...@@ -862,12 +863,12 @@ again:
static char *lxc_secure_rename_in_ns(int pid, char *oldname, char *newname, static char *lxc_secure_rename_in_ns(int pid, char *oldname, char *newname,
int *container_veth_ifidx) int *container_veth_ifidx)
{ {
int ret; int ofd, ret;
pid_t pid_self; pid_t pid_self;
uid_t ruid, suid, euid; uid_t ruid, suid, euid;
char ifname[IFNAMSIZ]; char ifname[IFNAMSIZ];
char *string_ret = NULL, *name = NULL; char *string_ret = NULL, *name = NULL;
int fd = -1, ifindex = -1, ofd = -1; int fd = -1, ifindex = -1;
pid_self = lxc_raw_getpid(); pid_self = lxc_raw_getpid();
...@@ -1035,11 +1036,10 @@ struct user_nic_args { ...@@ -1035,11 +1036,10 @@ struct user_nic_args {
static bool is_privileged_over_netns(int netns_fd) static bool is_privileged_over_netns(int netns_fd)
{ {
int ret; int ofd, ret;
pid_t pid_self; pid_t pid_self;
uid_t euid, ruid, suid; uid_t euid, ruid, suid;
bool bret = false; bool bret = false;
int ofd = -1;
pid_self = lxc_raw_getpid(); pid_self = lxc_raw_getpid();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment