Skip to content

Commit

Permalink
cgroups: rewind() file before polling again
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Feb 26, 2021
1 parent cb1c254 commit cfb4d8d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/lxc/cgroups/cgfsng.c
Expand Up @@ -2033,9 +2033,6 @@ static int freezer_cgroup_events_cb(int fd, uint32_t events, void *cbdata,
size_t len;
const char *state_string;

if (lseek(fd, 0, SEEK_SET) < (off_t)-1)
return LXC_MAINLOOP_ERROR;

f = fdopen_at(fd, "", "re", PROTECT_OPEN, PROTECT_LOOKUP_BENEATH);
if (!f)
return LXC_MAINLOOP_ERROR;
Expand All @@ -2049,6 +2046,8 @@ static int freezer_cgroup_events_cb(int fd, uint32_t events, void *cbdata,
if (strncmp(line, state_string, STRLITERALLEN("frozen") + 2) == 0)
return LXC_MAINLOOP_CLOSE;

rewind(f);

return LXC_MAINLOOP_CONTINUE;
}

Expand Down

0 comments on commit cfb4d8d

Please sign in to comment.