cgroup: Remove unused mntent variables

Spotted by coverity, we were now assigning mntent but only every using mntent_r, so drop those variables and assignation. Signed-off-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent fd37327f
...@@ -105,7 +105,7 @@ static char *mount_has_subsystem(const struct mntent *mntent) ...@@ -105,7 +105,7 @@ static char *mount_has_subsystem(const struct mntent *mntent)
*/ */
static int get_cgroup_mount(const char *subsystem, char *mnt) static int get_cgroup_mount(const char *subsystem, char *mnt)
{ {
struct mntent *mntent, mntent_r; struct mntent mntent_r;
FILE *file = NULL; FILE *file = NULL;
int ret, err = -1; int ret, err = -1;
...@@ -117,7 +117,7 @@ static int get_cgroup_mount(const char *subsystem, char *mnt) ...@@ -117,7 +117,7 @@ static int get_cgroup_mount(const char *subsystem, char *mnt)
return -1; return -1;
} }
while ((mntent = getmntent_r(file, &mntent_r, buf, sizeof(buf)))) { while ((getmntent_r(file, &mntent_r, buf, sizeof(buf)))) {
if (strcmp(mntent_r.mnt_type, "cgroup") != 0) if (strcmp(mntent_r.mnt_type, "cgroup") != 0)
continue; continue;
...@@ -517,7 +517,7 @@ static void set_clone_children(const char *mntdir) ...@@ -517,7 +517,7 @@ static void set_clone_children(const char *mntdir)
static int create_lxcgroups(const char *lxcgroup) static int create_lxcgroups(const char *lxcgroup)
{ {
FILE *file = NULL; FILE *file = NULL;
struct mntent *mntent, mntent_r; struct mntent mntent_r;
int ret, retv = -1; int ret, retv = -1;
char path[MAXPATHLEN]; char path[MAXPATHLEN];
...@@ -529,7 +529,7 @@ static int create_lxcgroups(const char *lxcgroup) ...@@ -529,7 +529,7 @@ static int create_lxcgroups(const char *lxcgroup)
return -1; return -1;
} }
while ((mntent = getmntent_r(file, &mntent_r, buf, sizeof(buf)))) { while ((getmntent_r(file, &mntent_r, buf, sizeof(buf)))) {
if (strcmp(mntent_r.mnt_type, "cgroup")) if (strcmp(mntent_r.mnt_type, "cgroup"))
continue; continue;
...@@ -591,7 +591,7 @@ char *lxc_cgroup_path_create(const char *lxcgroup, const char *name) ...@@ -591,7 +591,7 @@ char *lxc_cgroup_path_create(const char *lxcgroup, const char *name)
char *retpath, path[MAXPATHLEN]; char *retpath, path[MAXPATHLEN];
char tail[12]; char tail[12];
FILE *file = NULL; FILE *file = NULL;
struct mntent *mntent, mntent_r; struct mntent mntent_r;
char buf[LARGE_MAXPATHLEN] = {0}; char buf[LARGE_MAXPATHLEN] = {0};
...@@ -610,7 +610,7 @@ again: ...@@ -610,7 +610,7 @@ again:
else else
*tail = '\0'; *tail = '\0';
while ((mntent = getmntent_r(file, &mntent_r, buf, sizeof(buf)))) { while ((getmntent_r(file, &mntent_r, buf, sizeof(buf)))) {
if (strcmp(mntent_r.mnt_type, "cgroup")) if (strcmp(mntent_r.mnt_type, "cgroup"))
continue; continue;
...@@ -658,7 +658,7 @@ int lxc_cgroup_enter(const char *cgpath, pid_t pid) ...@@ -658,7 +658,7 @@ int lxc_cgroup_enter(const char *cgpath, pid_t pid)
{ {
char path[MAXPATHLEN]; char path[MAXPATHLEN];
FILE *file = NULL, *fout; FILE *file = NULL, *fout;
struct mntent *mntent, mntent_r; struct mntent mntent_r;
int ret, retv = -1; int ret, retv = -1;
char buf[LARGE_MAXPATHLEN] = {0}; char buf[LARGE_MAXPATHLEN] = {0};
...@@ -668,7 +668,7 @@ int lxc_cgroup_enter(const char *cgpath, pid_t pid) ...@@ -668,7 +668,7 @@ int lxc_cgroup_enter(const char *cgpath, pid_t pid)
return -1; return -1;
} }
while ((mntent = getmntent_r(file, &mntent_r, buf, sizeof(buf)))) { while ((getmntent_r(file, &mntent_r, buf, sizeof(buf)))) {
if (strcmp(mntent_r.mnt_type, "cgroup")) if (strcmp(mntent_r.mnt_type, "cgroup"))
continue; continue;
if (!mount_has_subsystem(&mntent_r)) if (!mount_has_subsystem(&mntent_r))
...@@ -766,7 +766,7 @@ static int lxc_one_cgroup_destroy(struct mntent *mntent, const char *cgpath) ...@@ -766,7 +766,7 @@ static int lxc_one_cgroup_destroy(struct mntent *mntent, const char *cgpath)
*/ */
int lxc_cgroup_destroy(const char *cgpath) int lxc_cgroup_destroy(const char *cgpath)
{ {
struct mntent *mntent, mntent_r; struct mntent mntent_r;
FILE *file = NULL; FILE *file = NULL;
int err, retv = 0; int err, retv = 0;
...@@ -778,7 +778,7 @@ int lxc_cgroup_destroy(const char *cgpath) ...@@ -778,7 +778,7 @@ int lxc_cgroup_destroy(const char *cgpath)
return -1; return -1;
} }
while ((mntent = getmntent_r(file, &mntent_r, buf, sizeof(buf)))) { while ((getmntent_r(file, &mntent_r, buf, sizeof(buf)))) {
if (strcmp(mntent_r.mnt_type, "cgroup")) if (strcmp(mntent_r.mnt_type, "cgroup"))
continue; continue;
if (!mount_has_subsystem(&mntent_r)) if (!mount_has_subsystem(&mntent_r))
......
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